Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-09-19 20:21:47 +0300
committerJacob Vosmaer <jacob@gitlab.com>2017-09-25 12:44:44 +0300
commitd88568dd4c65cbcbc1f5ef4d4e745eb5ee221eb5 (patch)
tree154ff0d17652a8abc3b5b33f4d8e73d5ad7e2862
parentc20e65f662224b05f7331b8cf547c225a5615b59 (diff)
Remove support for legacy services not ending in 'Service'
-rw-r--r--CHANGELOG.md2
-rw-r--r--internal/service/register.go45
-rw-r--r--internal/service/renameadapter/commit.go23
-rw-r--r--internal/service/renameadapter/diff.go20
-rw-r--r--internal/service/renameadapter/notifications.go19
-rw-r--r--internal/service/renameadapter/ref.go32
-rw-r--r--internal/service/renameadapter/smarthttp.go28
-rw-r--r--internal/service/renameadapter/ssh.go20
-rw-r--r--internal/service/smarthttp/testhelper_test.go7
9 files changed, 14 insertions, 182 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b34220e0c..516ef0a4d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,8 @@ UNRELEASED
https://gitlab.com/gitlab-org/gitaly/merge_requests/361
- Fix path bug for gitlab-shell. gitlab-shell path is now required
https://gitlab.com/gitlab-org/gitaly/merge_requests/365
+- Remove support for legacy services not ending in 'Service'
+ https://gitlab.com/gitlab-org/gitaly/merge_requests/363
v0.40.0
- Use context cancellation instead of command.Close
diff --git a/internal/service/register.go b/internal/service/register.go
index cfdd93584..f36db42f0 100644
--- a/internal/service/register.go
+++ b/internal/service/register.go
@@ -10,7 +10,6 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/service/notifications"
"gitlab.com/gitlab-org/gitaly/internal/service/operations"
"gitlab.com/gitlab-org/gitaly/internal/service/ref"
- "gitlab.com/gitlab-org/gitaly/internal/service/renameadapter"
"gitlab.com/gitlab-org/gitaly/internal/service/repository"
"gitlab.com/gitlab-org/gitaly/internal/service/smarthttp"
"gitlab.com/gitlab-org/gitaly/internal/service/ssh"
@@ -23,42 +22,16 @@ import (
// RegisterAll will register all the known grpc services with
// the specified grpc service instance
func RegisterAll(grpcServer *grpc.Server, rubyServer *rubyserver.Server) {
- notificationsService := notifications.NewServer()
- pb.RegisterNotificationServiceServer(grpcServer, notificationsService)
-
- refService := ref.NewServer(rubyServer)
- pb.RegisterRefServiceServer(grpcServer, refService)
-
- smartHTTPService := smarthttp.NewServer()
- pb.RegisterSmartHTTPServiceServer(grpcServer, smartHTTPService)
-
- diffService := diff.NewServer(rubyServer)
- pb.RegisterDiffServiceServer(grpcServer, diffService)
-
- commitService := commit.NewServer(rubyServer)
- pb.RegisterCommitServiceServer(grpcServer, commitService)
-
- sshService := ssh.NewServer()
- pb.RegisterSSHServiceServer(grpcServer, sshService)
-
- blobService := blob.NewServer()
- pb.RegisterBlobServiceServer(grpcServer, blobService)
-
+ pb.RegisterBlobServiceServer(grpcServer, blob.NewServer())
+ pb.RegisterCommitServiceServer(grpcServer, commit.NewServer(rubyServer))
+ pb.RegisterDiffServiceServer(grpcServer, diff.NewServer(rubyServer))
+ pb.RegisterNamespaceServiceServer(grpcServer, namespace.NewServer())
+ pb.RegisterNotificationServiceServer(grpcServer, notifications.NewServer())
+ pb.RegisterOperationServiceServer(grpcServer, operations.NewServer(rubyServer))
+ pb.RegisterRefServiceServer(grpcServer, ref.NewServer(rubyServer))
pb.RegisterRepositoryServiceServer(grpcServer, repository.NewServer(rubyServer))
-
- namespaceService := namespace.NewServer()
- pb.RegisterNamespaceServiceServer(grpcServer, namespaceService)
-
- operationService := operations.NewServer(rubyServer)
- pb.RegisterOperationServiceServer(grpcServer, operationService)
-
- // Deprecated Services
- pb.RegisterNotificationsServer(grpcServer, renameadapter.NewNotificationAdapter(notificationsService))
- pb.RegisterRefServer(grpcServer, renameadapter.NewRefAdapter(refService))
- pb.RegisterSmartHTTPServer(grpcServer, renameadapter.NewSmartHTTPAdapter(smartHTTPService))
- pb.RegisterDiffServer(grpcServer, renameadapter.NewDiffAdapter(diffService))
- pb.RegisterCommitServer(grpcServer, renameadapter.NewCommitAdapter(commitService))
- pb.RegisterSSHServer(grpcServer, renameadapter.NewSSHAdapter(sshService))
+ pb.RegisterSSHServiceServer(grpcServer, ssh.NewServer())
+ pb.RegisterSmartHTTPServiceServer(grpcServer, smarthttp.NewServer())
healthpb.RegisterHealthServer(grpcServer, health.NewServer())
}
diff --git a/internal/service/renameadapter/commit.go b/internal/service/renameadapter/commit.go
deleted file mode 100644
index d46efc66d..000000000
--- a/internal/service/renameadapter/commit.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package renameadapter
-
-import (
- pb "gitlab.com/gitlab-org/gitaly-proto/go"
- "golang.org/x/net/context"
-)
-
-type commitAdapter struct {
- upstream pb.CommitServiceServer
-}
-
-func (s *commitAdapter) CommitIsAncestor(ctx context.Context, req *pb.CommitIsAncestorRequest) (*pb.CommitIsAncestorResponse, error) {
- return s.upstream.CommitIsAncestor(ctx, req)
-}
-
-func (s *commitAdapter) TreeEntry(req *pb.TreeEntryRequest, res pb.Commit_TreeEntryServer) error {
- return s.upstream.TreeEntry(req, res)
-}
-
-// NewCommitAdapter adapts CommitServiceServer to CommitServer
-func NewCommitAdapter(upstream pb.CommitServiceServer) pb.CommitServer {
- return &commitAdapter{upstream}
-}
diff --git a/internal/service/renameadapter/diff.go b/internal/service/renameadapter/diff.go
deleted file mode 100644
index 06f437569..000000000
--- a/internal/service/renameadapter/diff.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package renameadapter
-
-import pb "gitlab.com/gitlab-org/gitaly-proto/go"
-
-type diffAdapter struct {
- upstream pb.DiffServiceServer
-}
-
-func (s *diffAdapter) CommitDiff(req *pb.CommitDiffRequest, res pb.Diff_CommitDiffServer) error {
- return s.upstream.CommitDiff(req, res)
-}
-
-func (s *diffAdapter) CommitDelta(req *pb.CommitDeltaRequest, res pb.Diff_CommitDeltaServer) error {
- return s.upstream.CommitDelta(req, res)
-}
-
-// NewDiffAdapter adapts DiffServiceServer to DiffServer
-func NewDiffAdapter(upstream pb.DiffServiceServer) pb.DiffServer {
- return &diffAdapter{upstream}
-}
diff --git a/internal/service/renameadapter/notifications.go b/internal/service/renameadapter/notifications.go
deleted file mode 100644
index 70f8fb20a..000000000
--- a/internal/service/renameadapter/notifications.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package renameadapter
-
-import (
- pb "gitlab.com/gitlab-org/gitaly-proto/go"
- "golang.org/x/net/context"
-)
-
-type notificationAdapter struct {
- upstream pb.NotificationServiceServer
-}
-
-func (s *notificationAdapter) PostReceive(ctx context.Context, req *pb.PostReceiveRequest) (*pb.PostReceiveResponse, error) {
- return s.upstream.PostReceive(ctx, req)
-}
-
-// NewNotificationAdapter adapts NotificationServiceServer to NotificationsServer
-func NewNotificationAdapter(upstream pb.NotificationServiceServer) pb.NotificationsServer {
- return &notificationAdapter{upstream}
-}
diff --git a/internal/service/renameadapter/ref.go b/internal/service/renameadapter/ref.go
deleted file mode 100644
index 9e97a829f..000000000
--- a/internal/service/renameadapter/ref.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package renameadapter
-
-import (
- pb "gitlab.com/gitlab-org/gitaly-proto/go"
- "golang.org/x/net/context"
-)
-
-type refAdapter struct {
- upstream pb.RefServiceServer
-}
-
-func (s *refAdapter) FindDefaultBranchName(ctx context.Context, req *pb.FindDefaultBranchNameRequest) (*pb.FindDefaultBranchNameResponse, error) {
- return s.upstream.FindDefaultBranchName(ctx, req)
-}
-
-func (s *refAdapter) FindAllBranchNames(req *pb.FindAllBranchNamesRequest, res pb.Ref_FindAllBranchNamesServer) error {
- return s.upstream.FindAllBranchNames(req, res)
-}
-func (s *refAdapter) FindAllTagNames(req *pb.FindAllTagNamesRequest, res pb.Ref_FindAllTagNamesServer) error {
- return s.upstream.FindAllTagNames(req, res)
-}
-func (s *refAdapter) FindRefName(ctx context.Context, req *pb.FindRefNameRequest) (*pb.FindRefNameResponse, error) {
- return s.upstream.FindRefName(ctx, req)
-}
-func (s *refAdapter) FindLocalBranches(req *pb.FindLocalBranchesRequest, res pb.Ref_FindLocalBranchesServer) error {
- return s.upstream.FindLocalBranches(req, res)
-}
-
-// NewRefAdapter adapts RefServiceServer to RefServer
-func NewRefAdapter(upstream pb.RefServiceServer) pb.RefServer {
- return &refAdapter{upstream}
-}
diff --git a/internal/service/renameadapter/smarthttp.go b/internal/service/renameadapter/smarthttp.go
deleted file mode 100644
index ae061f422..000000000
--- a/internal/service/renameadapter/smarthttp.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package renameadapter
-
-import pb "gitlab.com/gitlab-org/gitaly-proto/go"
-
-type smartHTTPAdapter struct {
- upstream pb.SmartHTTPServiceServer
-}
-
-func (s *smartHTTPAdapter) InfoRefsUploadPack(in *pb.InfoRefsRequest, stream pb.SmartHTTP_InfoRefsUploadPackServer) error {
- return s.upstream.InfoRefsUploadPack(in, stream)
-}
-
-func (s *smartHTTPAdapter) InfoRefsReceivePack(in *pb.InfoRefsRequest, stream pb.SmartHTTP_InfoRefsReceivePackServer) error {
- return s.upstream.InfoRefsReceivePack(in, stream)
-}
-
-func (s *smartHTTPAdapter) PostUploadPack(stream pb.SmartHTTP_PostUploadPackServer) error {
- return s.upstream.PostUploadPack(stream)
-}
-
-func (s *smartHTTPAdapter) PostReceivePack(stream pb.SmartHTTP_PostReceivePackServer) error {
- return s.upstream.PostReceivePack(stream)
-}
-
-// NewSmartHTTPAdapter creates an adapter between SmartHTTPServiceServer and SmartHTTPServer
-func NewSmartHTTPAdapter(upstream pb.SmartHTTPServiceServer) pb.SmartHTTPServer {
- return &smartHTTPAdapter{upstream}
-}
diff --git a/internal/service/renameadapter/ssh.go b/internal/service/renameadapter/ssh.go
deleted file mode 100644
index 8af05ef3f..000000000
--- a/internal/service/renameadapter/ssh.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package renameadapter
-
-import pb "gitlab.com/gitlab-org/gitaly-proto/go"
-
-type sshAdapter struct {
- upstream pb.SSHServiceServer
-}
-
-func (s *sshAdapter) SSHUploadPack(stream pb.SSH_SSHUploadPackServer) error {
- return s.upstream.SSHUploadPack(stream)
-}
-
-func (s *sshAdapter) SSHReceivePack(stream pb.SSH_SSHReceivePackServer) error {
- return s.upstream.SSHReceivePack(stream)
-}
-
-// NewSSHAdapter creates a sshAdapter between SSHServiceServer and SSHServer
-func NewSSHAdapter(upstream pb.SSHServiceServer) pb.SSHServer {
- return &sshAdapter{upstream}
-}
diff --git a/internal/service/smarthttp/testhelper_test.go b/internal/service/smarthttp/testhelper_test.go
index 316e106e4..49be3bdc2 100644
--- a/internal/service/smarthttp/testhelper_test.go
+++ b/internal/service/smarthttp/testhelper_test.go
@@ -9,7 +9,6 @@ import (
pb "gitlab.com/gitlab-org/gitaly-proto/go"
- "gitlab.com/gitlab-org/gitaly/internal/service/renameadapter"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
@@ -30,7 +29,7 @@ func runSmartHTTPServer(t *testing.T) *grpc.Server {
t.Fatal(err)
}
- pb.RegisterSmartHTTPServer(server, renameadapter.NewSmartHTTPAdapter(NewServer()))
+ pb.RegisterSmartHTTPServiceServer(server, NewServer())
reflection.Register(server)
go server.Serve(listener)
@@ -38,7 +37,7 @@ func runSmartHTTPServer(t *testing.T) *grpc.Server {
return server
}
-func newSmartHTTPClient(t *testing.T) (pb.SmartHTTPClient, *grpc.ClientConn) {
+func newSmartHTTPClient(t *testing.T) (pb.SmartHTTPServiceClient, *grpc.ClientConn) {
connOpts := []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithDialer(func(addr string, _ time.Duration) (net.Conn, error) {
@@ -50,5 +49,5 @@ func newSmartHTTPClient(t *testing.T) (pb.SmartHTTPClient, *grpc.ClientConn) {
t.Fatal(err)
}
- return pb.NewSmartHTTPClient(conn), conn
+ return pb.NewSmartHTTPServiceClient(conn), conn
}