diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-09-09 13:53:33 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-09-15 09:45:55 +0300 |
commit | 6661350509f7980237c9634d5f94b2a9f9149713 (patch) | |
tree | 1969eff8b526b33123584a67725b5c2f07e97ebe | |
parent | fc154679324dab09675277d9f8c4a37d3d4e34f0 (diff) |
operations: Inject prereqs for UserMergeBranch into the server
As we're about to port the OperationService.UserMergeBranch RPC from
Ruby to Go, we'll require some additional dependencies in the
OperationsServer. In order to not do this as part of the actual
implementation, this commit does this as a preparatory step.
-rw-r--r-- | internal/gitaly/service/operations/server.go | 17 | ||||
-rw-r--r-- | internal/gitaly/service/operations/testhelper_test.go | 7 | ||||
-rw-r--r-- | internal/gitaly/service/register.go | 2 |
3 files changed, 20 insertions, 6 deletions
diff --git a/internal/gitaly/service/operations/server.go b/internal/gitaly/service/operations/server.go index 56224fa68..3113a460e 100644 --- a/internal/gitaly/service/operations/server.go +++ b/internal/gitaly/service/operations/server.go @@ -1,16 +1,27 @@ package operations import ( + "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" + "gitlab.com/gitlab-org/gitaly/internal/gitaly/hook" "gitlab.com/gitlab-org/gitaly/internal/gitaly/rubyserver" + "gitlab.com/gitlab-org/gitaly/internal/storage" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" ) type server struct { - ruby *rubyserver.Server + cfg config.Cfg + ruby *rubyserver.Server + hookManager *hook.Manager + locator storage.Locator gitalypb.UnimplementedOperationServiceServer } // NewServer creates a new instance of a grpc OperationServiceServer -func NewServer(rs *rubyserver.Server) gitalypb.OperationServiceServer { - return &server{ruby: rs} +func NewServer(cfg config.Cfg, rs *rubyserver.Server, hookManager *hook.Manager, locator storage.Locator) gitalypb.OperationServiceServer { + return &server{ + ruby: rs, + cfg: cfg, + hookManager: hookManager, + locator: locator, + } } diff --git a/internal/gitaly/service/operations/testhelper_test.go b/internal/gitaly/service/operations/testhelper_test.go index 6e10b42e6..6de86419d 100644 --- a/internal/gitaly/service/operations/testhelper_test.go +++ b/internal/gitaly/service/operations/testhelper_test.go @@ -87,9 +87,12 @@ func runOperationServiceServerWithRubyServer(t *testing.T, ruby *rubyserver.Serv internalListener, err := net.Listen("unix", internalSocket) require.NoError(t, err) + hookManager := gitalyhook.NewManager(gitalyhook.GitlabAPIStub, config.Config) locator := config.NewLocator(config.Config) - gitalypb.RegisterOperationServiceServer(srv.GrpcServer(), &server{ruby: ruby}) - gitalypb.RegisterHookServiceServer(srv.GrpcServer(), hook.NewServer(gitalyhook.NewManager(gitalyhook.GitlabAPIStub, config.Config))) + server := NewServer(config.Config, ruby, hookManager, locator) + + gitalypb.RegisterOperationServiceServer(srv.GrpcServer(), server) + gitalypb.RegisterHookServiceServer(srv.GrpcServer(), hook.NewServer(hookManager)) gitalypb.RegisterRepositoryServiceServer(srv.GrpcServer(), repository.NewServer(ruby, locator, internalSocket)) gitalypb.RegisterRefServiceServer(srv.GrpcServer(), ref.NewServer()) gitalypb.RegisterCommitServiceServer(srv.GrpcServer(), commit.NewServer(locator)) diff --git a/internal/gitaly/service/register.go b/internal/gitaly/service/register.go index d0efe3166..cd9de4afa 100644 --- a/internal/gitaly/service/register.go +++ b/internal/gitaly/service/register.go @@ -73,7 +73,7 @@ func RegisterAll(grpcServer *grpc.Server, cfg config.Cfg, rubyServer *rubyserver gitalypb.RegisterCommitServiceServer(grpcServer, commit.NewServer(locator)) gitalypb.RegisterDiffServiceServer(grpcServer, diff.NewServer()) gitalypb.RegisterNamespaceServiceServer(grpcServer, namespace.NewServer()) - gitalypb.RegisterOperationServiceServer(grpcServer, operations.NewServer(rubyServer)) + gitalypb.RegisterOperationServiceServer(grpcServer, operations.NewServer(cfg, rubyServer, hookManager, locator)) gitalypb.RegisterRefServiceServer(grpcServer, ref.NewServer()) gitalypb.RegisterRepositoryServiceServer(grpcServer, repository.NewServer(rubyServer, locator, config.GitalyInternalSocketPath())) gitalypb.RegisterSSHServiceServer(grpcServer, ssh.NewServer( |