Skip to content

Commit

Permalink
PMM-12836 remove grpc wrappers for node & mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Feb 12, 2024
1 parent f0e7bb1 commit 5e97296
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 90 deletions.
4 changes: 2 additions & 2 deletions managed/cmd/pmm-managed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ func runGRPCServer(ctx context.Context, deps *gRPCServerDeps) {
postgresqlSvc := management.NewPostgreSQLService(deps.db, deps.agentsStateUpdater, deps.connectionCheck, deps.serviceInfoBroker)
proxysqlSvc := management.NewProxySQLService(deps.db, deps.agentsStateUpdater, deps.connectionCheck, deps.serviceInfoBroker)

managementv1.RegisterNodeServiceServer(gRPCServer, managementgrpc.NewManagementNodeServer(nodeSvc))
managementv1.RegisterNodeServiceServer(gRPCServer, nodeSvc)
agentv1beta1.RegisterAgentServiceServer(gRPCServer, agentSvc)
nodev1beta1.RegisterMgmtNodeServiceServer(gRPCServer, management.NewMgmtNodeService(deps.db, deps.agentsRegistry, v1.NewAPI(*deps.vmClient)))
servicev1beta1.RegisterMgmtServiceServer(gRPCServer, management.NewMgmtServiceService(deps.db, deps.agentsRegistry, deps.agentsStateUpdater, deps.vmdb, v1.NewAPI(*deps.vmClient)))
managementv1.RegisterServiceServer(gRPCServer, serviceSvc)
managementv1.RegisterMySQLServiceServer(gRPCServer, managementgrpc.NewManagementMySQLServer(mysqlSvc))
managementv1.RegisterMySQLServiceServer(gRPCServer, mysqlSvc)
managementv1.RegisterMongoDBServiceServer(gRPCServer, managementgrpc.NewManagementMongoDBServer(mongodbSvc))
managementv1.RegisterPostgreSQLServiceServer(gRPCServer, managementgrpc.NewManagementPostgreSQLServer(postgresqlSvc))
managementv1.RegisterProxySQLServiceServer(gRPCServer, managementgrpc.NewManagementProxySQLServer(proxysqlSvc))
Expand Down
40 changes: 0 additions & 40 deletions managed/services/management/grpc/mysql_server.go

This file was deleted.

40 changes: 0 additions & 40 deletions managed/services/management/grpc/node_server.go

This file was deleted.

6 changes: 4 additions & 2 deletions managed/services/management/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type MySQLService struct {
cc connectionChecker
vc versionCache
sib serviceInfoBroker

managementv1.UnimplementedMySQLServiceServer
}

// NewMySQLService creates new MySQL Management Service.
Expand All @@ -52,8 +54,8 @@ func NewMySQLService(db *reform.DB, state agentsStateUpdater, cc connectionCheck
}
}

// Add adds "MySQL Service", "MySQL Exporter Agent" and "QAN MySQL PerfSchema Agent".
func (s *MySQLService) Add(ctx context.Context, req *managementv1.AddMySQLRequest) (*managementv1.AddMySQLResponse, error) {
// AddMySQL adds "MySQL Service", "MySQL Exporter Agent" and "QAN MySQL PerfSchema Agent".
func (s *MySQLService) AddMySQL(ctx context.Context, req *managementv1.AddMySQLRequest) (*managementv1.AddMySQLResponse, error) {
res := &managementv1.AddMySQLResponse{}

if e := s.db.InTransaction(func(tx *reform.TX) error {
Expand Down
6 changes: 4 additions & 2 deletions managed/services/management/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type NodeService struct {
akp apiKeyProvider

l *logrus.Entry

managementv1.UnimplementedNodeServiceServer
}

// NewNodeService creates NodeService instance.
Expand All @@ -51,8 +53,8 @@ func NewNodeService(db *reform.DB, akp apiKeyProvider) *NodeService {
}
}

// Register do registration of the new node.
func (s *NodeService) Register(ctx context.Context, req *managementv1.RegisterNodeRequest) (*managementv1.RegisterNodeResponse, error) {
// Register performs the registration of a new node.
func (s *NodeService) RegisterNode(ctx context.Context, req *managementv1.RegisterNodeRequest) (*managementv1.RegisterNodeResponse, error) {
res := &managementv1.RegisterNodeResponse{}

e := s.db.InTransaction(func(tx *reform.TX) error {
Expand Down
8 changes: 4 additions & 4 deletions managed/services/management/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestNodeService(t *testing.T) {
ctx, s, teardown := setup(t)
defer teardown(t)

res, err := s.Register(ctx, &managementv1.RegisterNodeRequest{
res, err := s.RegisterNode(ctx, &managementv1.RegisterNodeRequest{
NodeType: inventoryv1.NodeType_NODE_TYPE_GENERIC_NODE,
NodeName: "node",
Address: "some.address.org",
Expand All @@ -95,7 +95,7 @@ func TestNodeService(t *testing.T) {
assert.NoError(t, err)

t.Run("Exist", func(t *testing.T) {
res, err = s.Register(ctx, &managementv1.RegisterNodeRequest{
res, err = s.RegisterNode(ctx, &managementv1.RegisterNodeRequest{
NodeType: inventoryv1.NodeType_NODE_TYPE_GENERIC_NODE,
NodeName: "node",
})
Expand All @@ -104,7 +104,7 @@ func TestNodeService(t *testing.T) {
})

t.Run("Reregister", func(t *testing.T) {
res, err = s.Register(ctx, &managementv1.RegisterNodeRequest{
res, err = s.RegisterNode(ctx, &managementv1.RegisterNodeRequest{
NodeType: inventoryv1.NodeType_NODE_TYPE_GENERIC_NODE,
NodeName: "node",
Address: "some.address.org",
Expand All @@ -129,7 +129,7 @@ func TestNodeService(t *testing.T) {
assert.NoError(t, err)
})
t.Run("Reregister-force", func(t *testing.T) {
res, err = s.Register(ctx, &managementv1.RegisterNodeRequest{
res, err = s.RegisterNode(ctx, &managementv1.RegisterNodeRequest{
NodeType: inventoryv1.NodeType_NODE_TYPE_GENERIC_NODE,
NodeName: "node-name-new",
Address: "some.address.org",
Expand Down

0 comments on commit 5e97296

Please sign in to comment.