diff options
author | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-11-20 23:50:36 +0300 |
---|---|---|
committer | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-11-20 23:50:36 +0300 |
commit | 3f55c303d2683913581119e79c03bded0588e153 (patch) | |
tree | 84b1735a5c1dd50655b30c8dcb822120231df5bf | |
parent | 276bfb610a543a5de88a1d5f69219811dad13a6b (diff) | |
parent | 948dd423cd42a028ab70fa5136ef24b965a5f2a3 (diff) |
Merge branch 'smh-remove-namespace-service' into 'master'
Remove NamespaceService
Closes #3803
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6292
Merged-by: Quang-Minh Nguyen <qmnguyen@gitlab.com>
Approved-by: karthik nayak <knayak@gitlab.com>
Co-authored-by: Sami Hiltunen <shiltunen@gitlab.com>
-rw-r--r-- | internal/gitaly/service/namespace/namespace.go | 123 | ||||
-rw-r--r-- | internal/gitaly/service/namespace/namespace_test.go | 286 | ||||
-rw-r--r-- | internal/gitaly/service/namespace/server.go | 22 | ||||
-rw-r--r-- | internal/gitaly/service/namespace/testhelper_test.go | 34 | ||||
-rw-r--r-- | internal/gitaly/service/setup/register.go | 2 | ||||
-rw-r--r-- | internal/grpc/protoregistry/method_info_test.go | 12 | ||||
-rw-r--r-- | internal/grpc/protoregistry/registry_test.go | 6 | ||||
-rw-r--r-- | internal/praefect/coordinator_test.go | 30 | ||||
-rw-r--r-- | proto/go/gitalypb/namespace.pb.go | 658 | ||||
-rw-r--r-- | proto/go/gitalypb/namespace_grpc.pb.go | 221 | ||||
-rw-r--r-- | proto/go/gitalypb/protolist.go | 1 | ||||
-rw-r--r-- | proto/namespace.proto | 98 |
12 files changed, 20 insertions, 1473 deletions
diff --git a/internal/gitaly/service/namespace/namespace.go b/internal/gitaly/service/namespace/namespace.go deleted file mode 100644 index e065fa90c..000000000 --- a/internal/gitaly/service/namespace/namespace.go +++ /dev/null @@ -1,123 +0,0 @@ -package namespace - -import ( - "context" - "errors" - "fmt" - "os" - "path/filepath" - - "gitlab.com/gitlab-org/gitaly/v16/internal/helper/perm" - "gitlab.com/gitlab-org/gitaly/v16/internal/structerr" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -var noNameError = status.Errorf(codes.InvalidArgument, "Name: cannot be empty") - -func (s *server) NamespaceExists(ctx context.Context, in *gitalypb.NamespaceExistsRequest) (*gitalypb.NamespaceExistsResponse, error) { - storagePath, err := s.locator.GetStorageByName(in.GetStorageName()) - if err != nil { - return nil, err - } - - // This case should return an error, as else we'd actually say the path exists as the - // storage exists - if in.GetName() == "" { - return nil, noNameError - } - - if fi, err := os.Stat(namespacePath(storagePath, in.GetName())); os.IsNotExist(err) { - return &gitalypb.NamespaceExistsResponse{Exists: false}, nil - } else if err != nil { - return nil, structerr.NewInternal("could not stat the directory: %w", err) - } else { - return &gitalypb.NamespaceExistsResponse{Exists: fi.IsDir()}, nil - } -} - -func (s *server) AddNamespace(ctx context.Context, in *gitalypb.AddNamespaceRequest) (*gitalypb.AddNamespaceResponse, error) { - storagePath, err := s.locator.GetStorageByName(in.GetStorageName()) - if err != nil { - return nil, err - } - - name := in.GetName() - if len(name) == 0 { - return nil, noNameError - } - - if err = os.MkdirAll(namespacePath(storagePath, name), perm.GroupPrivateDir); err != nil { - return nil, structerr.NewInternal("create directory: %w", err) - } - - return &gitalypb.AddNamespaceResponse{}, nil -} - -func (s *server) validateRenameNamespaceRequest(ctx context.Context, in *gitalypb.RenameNamespaceRequest) error { - if in.GetFrom() == "" || in.GetTo() == "" { - return errors.New("from and to cannot be empty") - } - - // No need to check if the from path exists, if it doesn't, we'd later get an - // os.LinkError - toExistsCheck := &gitalypb.NamespaceExistsRequest{StorageName: in.StorageName, Name: in.GetTo()} - if exists, err := s.NamespaceExists(ctx, toExistsCheck); err != nil { - return err - } else if exists.Exists { - return fmt.Errorf("to directory %s already exists", in.GetTo()) - } - - return nil -} - -func (s *server) RenameNamespace(ctx context.Context, in *gitalypb.RenameNamespaceRequest) (*gitalypb.RenameNamespaceResponse, error) { - if err := s.validateRenameNamespaceRequest(ctx, in); err != nil { - return nil, structerr.NewInvalidArgument("%w", err) - } - - storagePath, err := s.locator.GetStorageByName(in.GetStorageName()) - if err != nil { - return nil, err - } - - targetPath := namespacePath(storagePath, in.GetTo()) - - // Create the parent directory. - if err = os.MkdirAll(filepath.Dir(targetPath), perm.SharedDir); err != nil { - return nil, structerr.NewInternal("create directory: %w", err) - } - - err = os.Rename(namespacePath(storagePath, in.GetFrom()), targetPath) - if _, ok := err.(*os.LinkError); ok { - return nil, structerr.NewInvalidArgument("from directory %s not found", in.GetFrom()) - } else if err != nil { - return nil, structerr.NewInternal("rename: %w", err) - } - - return &gitalypb.RenameNamespaceResponse{}, nil -} - -func (s *server) RemoveNamespace(ctx context.Context, in *gitalypb.RemoveNamespaceRequest) (*gitalypb.RemoveNamespaceResponse, error) { - storagePath, err := s.locator.GetStorageByName(in.GetStorageName()) - if err != nil { - return nil, err - } - - // Needed as else we might destroy the whole storage - if in.GetName() == "" { - return nil, noNameError - } - - // os.RemoveAll is idempotent by itself - // No need to check if the directory exists, or not - if err = os.RemoveAll(namespacePath(storagePath, in.GetName())); err != nil { - return nil, structerr.NewInternal("removal: %w", err) - } - return &gitalypb.RemoveNamespaceResponse{}, nil -} - -func namespacePath(storage, ns string) string { - return filepath.Join(storage, ns) -} diff --git a/internal/gitaly/service/namespace/namespace_test.go b/internal/gitaly/service/namespace/namespace_test.go deleted file mode 100644 index d49b78fcf..000000000 --- a/internal/gitaly/service/namespace/namespace_test.go +++ /dev/null @@ -1,286 +0,0 @@ -package namespace - -import ( - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" - "gitlab.com/gitlab-org/gitaly/v16/internal/helper/perm" - "gitlab.com/gitlab-org/gitaly/v16/internal/structerr" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper/testserver" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" -) - -func TestNamespaceExists(t *testing.T) { - cfg, client := setupNamespaceService(t, testserver.WithDisablePraefect()) - existingStorage := cfg.Storages[0] - ctx := testhelper.Context(t) - - const existingNamespace = "existing" - require.NoError(t, os.MkdirAll(filepath.Join(existingStorage.Path, existingNamespace), perm.SharedDir)) - - for _, tc := range []struct { - desc string - request *gitalypb.NamespaceExistsRequest - expectedResponse *gitalypb.NamespaceExistsResponse - expectedErr error - }{ - { - desc: "empty name", - request: &gitalypb.NamespaceExistsRequest{ - StorageName: existingStorage.Name, - Name: "", - }, - expectedErr: structerr.NewInvalidArgument("Name: cannot be empty"), - }, - { - desc: "Namespace doesn't exists", - request: &gitalypb.NamespaceExistsRequest{ - StorageName: existingStorage.Name, - Name: "not-existing", - }, - expectedResponse: &gitalypb.NamespaceExistsResponse{ - Exists: false, - }, - }, - { - desc: "Wrong storage path", - request: &gitalypb.NamespaceExistsRequest{ - StorageName: "other", - Name: existingNamespace, - }, - expectedResponse: &gitalypb.NamespaceExistsResponse{ - Exists: false, - }, - }, - { - desc: "Namespace exists", - request: &gitalypb.NamespaceExistsRequest{ - StorageName: existingStorage.Name, - Name: existingNamespace, - }, - expectedResponse: &gitalypb.NamespaceExistsResponse{ - Exists: true, - }, - }, - } { - tc := tc - - t.Run(tc.desc, func(t *testing.T) { - t.Parallel() - - response, err := client.NamespaceExists(ctx, tc.request) - testhelper.RequireGrpcError(t, tc.expectedErr, err) - testhelper.ProtoEqual(t, tc.expectedResponse, response) - }) - } -} - -func getStorageDir(t *testing.T, cfg config.Cfg, storageName string) string { - t.Helper() - s, found := cfg.Storage(storageName) - require.True(t, found) - return s.Path -} - -func TestAddNamespace(t *testing.T) { - testhelper.SkipWithPraefect(t, "per_repository election strategy doesn't support storage scoped mutators") - - ctx := testhelper.Context(t) - cfg, client := setupNamespaceService(t) - existingStorage := cfg.Storages[0] - - for _, tc := range []struct { - desc string - request *gitalypb.AddNamespaceRequest - expectedErr error - }{ - { - desc: "No name", - request: &gitalypb.AddNamespaceRequest{ - StorageName: existingStorage.Name, - Name: "", - }, - expectedErr: structerr.NewInvalidArgument("Name: cannot be empty"), - }, - { - desc: "Namespace is successfully created", - request: &gitalypb.AddNamespaceRequest{ - StorageName: existingStorage.Name, - Name: "create-me", - }, - }, - { - desc: "Idempotent on creation", - request: &gitalypb.AddNamespaceRequest{ - StorageName: existingStorage.Name, - Name: "create-me", - }, - }, - { - desc: "no storage", - request: &gitalypb.AddNamespaceRequest{ - StorageName: "", - Name: "mepmep", - }, - expectedErr: structerr.NewInvalidArgument("%w", storage.ErrStorageNotSet), - }, - } { - tc := tc - - t.Run(tc.desc, func(t *testing.T) { - t.Parallel() - - _, err := client.AddNamespace(ctx, tc.request) - testhelper.RequireGrpcError(t, tc.expectedErr, err) - if tc.expectedErr == nil { - require.DirExists(t, filepath.Join(existingStorage.Path, tc.request.Name)) - } - }) - } -} - -func TestRemoveNamespace(t *testing.T) { - testhelper.SkipWithPraefect(t, "per_repository election strategy doesn't support storage scoped mutators") - - cfg, client := setupNamespaceService(t) - existingStorage := cfg.Storages[0] - ctx := testhelper.Context(t) - - const existingNamespace = "created" - require.NoError(t, os.MkdirAll(filepath.Join(existingStorage.Path, existingNamespace), perm.SharedDir), "test setup") - - queries := []struct { - desc string - request *gitalypb.RemoveNamespaceRequest - expectedErr error - }{ - { - desc: "Namespace is successfully removed", - request: &gitalypb.RemoveNamespaceRequest{ - StorageName: existingStorage.Name, - Name: existingNamespace, - }, - }, - { - desc: "Idempotent on deletion", - request: &gitalypb.RemoveNamespaceRequest{ - StorageName: existingStorage.Name, - Name: "not-there", - }, - }, - { - desc: "no storage", - request: &gitalypb.RemoveNamespaceRequest{ - StorageName: "", - Name: "mepmep", - }, - expectedErr: structerr.NewInvalidArgument("%w", storage.ErrStorageNotSet), - }, - } - - for _, tc := range queries { - tc := tc - - t.Run(tc.desc, func(t *testing.T) { - t.Parallel() - - _, err := client.RemoveNamespace(ctx, tc.request) - testhelper.RequireGrpcError(t, tc.expectedErr, err) - if tc.expectedErr == nil { - require.NoFileExists(t, filepath.Join(existingStorage.Path, tc.request.Name)) - } - }) - } -} - -func TestRenameNamespace(t *testing.T) { - testhelper.SkipWithPraefect(t, "per_repository election strategy doesn't support storage scoped mutators") - - cfg, client := setupNamespaceService(t) - existingStorage := cfg.Storages[0] - ctx := testhelper.Context(t) - - const existingNamespace = "existing" - require.NoError(t, os.MkdirAll(filepath.Join(existingStorage.Path, existingNamespace), perm.SharedDir)) - - for _, tc := range []struct { - desc string - request *gitalypb.RenameNamespaceRequest - expectedErr error - }{ - { - desc: "Renaming an existing namespace", - request: &gitalypb.RenameNamespaceRequest{ - From: existingNamespace, - To: "new-path", - StorageName: existingStorage.Name, - }, - }, - { - desc: "No from given", - request: &gitalypb.RenameNamespaceRequest{ - From: "", - To: "new-path", - StorageName: existingStorage.Name, - }, - expectedErr: structerr.NewInvalidArgument("from and to cannot be empty"), - }, - { - desc: "non-existing namespace", - request: &gitalypb.RenameNamespaceRequest{ - From: "non-existing", - To: "new-path", - StorageName: existingStorage.Name, - }, - expectedErr: structerr.NewInvalidArgument("to directory new-path already exists"), - }, - { - desc: "existing destination namespace", - request: &gitalypb.RenameNamespaceRequest{ - From: existingNamespace, - To: existingNamespace, - StorageName: existingStorage.Name, - }, - expectedErr: structerr.NewInvalidArgument("from directory existing not found"), - }, - } { - t.Run(tc.desc, func(t *testing.T) { - _, err := client.RenameNamespace(ctx, tc.request) - testhelper.RequireGrpcError(t, tc.expectedErr, err) - if tc.expectedErr == nil { - require.DirExists(t, filepath.Join(existingStorage.Path, tc.request.To)) - } - }) - } -} - -func TestRenameNamespaceWithNonexistentParentDir(t *testing.T) { - testhelper.SkipWithPraefect(t, "per_repository election strategy doesn't support storage scoped mutators") - - cfg, client := setupNamespaceService(t) - existingStorage := cfg.Storages[0] - ctx := testhelper.Context(t) - - _, err := client.AddNamespace(ctx, &gitalypb.AddNamespaceRequest{ - StorageName: existingStorage.Name, - Name: "existing", - }) - require.NoError(t, err) - - _, err = client.RenameNamespace(ctx, &gitalypb.RenameNamespaceRequest{ - From: "existing", - To: "some/other/new-path", - StorageName: existingStorage.Name, - }) - require.NoError(t, err) - - storagePath := getStorageDir(t, cfg, existingStorage.Name) - require.NoError(t, err) - toDir := namespacePath(storagePath, "some/other/new-path") - require.DirExists(t, toDir) -} diff --git a/internal/gitaly/service/namespace/server.go b/internal/gitaly/service/namespace/server.go deleted file mode 100644 index 3646891db..000000000 --- a/internal/gitaly/service/namespace/server.go +++ /dev/null @@ -1,22 +0,0 @@ -package namespace - -import ( - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" - "gitlab.com/gitlab-org/gitaly/v16/internal/log" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" -) - -type server struct { - gitalypb.UnimplementedNamespaceServiceServer - logger log.Logger - locator storage.Locator -} - -// NewServer creates a new instance of a gRPC namespace server -func NewServer(deps *service.Dependencies) gitalypb.NamespaceServiceServer { - return &server{ - logger: deps.GetLogger(), - locator: deps.GetLocator(), - } -} diff --git a/internal/gitaly/service/namespace/testhelper_test.go b/internal/gitaly/service/namespace/testhelper_test.go deleted file mode 100644 index 79b1a5a8d..000000000 --- a/internal/gitaly/service/namespace/testhelper_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package namespace - -import ( - "testing" - - "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper/testcfg" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper/testserver" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" -) - -func TestMain(m *testing.M) { - testhelper.Run(m) -} - -func setupNamespaceService(tb testing.TB, opts ...testserver.GitalyServerOpt) (config.Cfg, gitalypb.NamespaceServiceClient) { - cfgBuilder := testcfg.NewGitalyCfgBuilder(testcfg.WithStorages("default", "other")) - cfg := cfgBuilder.Build(tb) - - addr := testserver.RunGitalyServer(tb, cfg, func(srv *grpc.Server, deps *service.Dependencies) { - gitalypb.RegisterNamespaceServiceServer(srv, NewServer(deps)) - }, opts...) - - conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) - require.NoError(tb, err) - tb.Cleanup(func() { testhelper.MustClose(tb, conn) }) - - return cfg, gitalypb.NewNamespaceServiceClient(conn) -} diff --git a/internal/gitaly/service/setup/register.go b/internal/gitaly/service/setup/register.go index 56cc2083a..4076abb84 100644 --- a/internal/gitaly/service/setup/register.go +++ b/internal/gitaly/service/setup/register.go @@ -12,7 +12,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/diff" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/hook" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/internalgitaly" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/namespace" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/objectpool" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/operations" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service/ref" @@ -56,7 +55,6 @@ func RegisterAll(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterCleanupServiceServer(srv, cleanup.NewServer(deps)) gitalypb.RegisterCommitServiceServer(srv, commit.NewServer(deps)) gitalypb.RegisterDiffServiceServer(srv, diff.NewServer(deps)) - gitalypb.RegisterNamespaceServiceServer(srv, namespace.NewServer(deps)) gitalypb.RegisterOperationServiceServer(srv, operations.NewServer(deps)) gitalypb.RegisterRefServiceServer(srv, ref.NewServer(deps)) gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(deps)) diff --git a/internal/grpc/protoregistry/method_info_test.go b/internal/grpc/protoregistry/method_info_test.go index 1e95408e2..9cc8b4a64 100644 --- a/internal/grpc/protoregistry/method_info_test.go +++ b/internal/grpc/protoregistry/method_info_test.go @@ -177,9 +177,9 @@ func TestMethodInfo_Storage(t *testing.T) { }{ { desc: "valid request type single depth", - svc: "NamespaceService", - method: "AddNamespace", - pbMsg: &gitalypb.AddNamespaceRequest{ + svc: "InternalGitaly", + method: "WalkRepos", + pbMsg: &gitalypb.WalkReposRequest{ StorageName: "some_storage", }, expectStorage: "some_storage", @@ -224,9 +224,9 @@ func TestMethodInfo_SetStorage(t *testing.T) { }{ { desc: "valid request type", - service: "NamespaceService", - method: "AddNamespace", - pbMsg: &gitalypb.AddNamespaceRequest{ + service: "InternalGitaly", + method: "WalkRepos", + pbMsg: &gitalypb.WalkReposRequest{ StorageName: "old_storage", }, storage: "new_storage", diff --git a/internal/grpc/protoregistry/registry_test.go b/internal/grpc/protoregistry/registry_test.go index 1727e52f7..de0ee38b3 100644 --- a/internal/grpc/protoregistry/registry_test.go +++ b/internal/grpc/protoregistry/registry_test.go @@ -49,12 +49,6 @@ func TestNewProtoRegistry(t *testing.T) { "RawDiff": OpAccessor, "RawPatch": OpAccessor, }, - "NamespaceService": { - "AddNamespace": OpMutator, - "NamespaceExists": OpAccessor, - "RemoveNamespace": OpMutator, - "RenameNamespace": OpMutator, - }, "ObjectPoolService": { "CreateObjectPool": OpMutator, "DeleteObjectPool": OpMutator, diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go index 4ca7722b7..212b4ee1b 100644 --- a/internal/praefect/coordinator_test.go +++ b/internal/praefect/coordinator_test.go @@ -1880,12 +1880,11 @@ func TestStreamDirectorStorageScope(t *testing.T) { ctx := testhelper.Context(t) t.Run("mutator", func(t *testing.T) { - fullMethod := "/gitaly.NamespaceService/RemoveNamespace" + fullMethod := "/gitaly.RepositoryService/RemoveAll" requireScopeOperation(t, coordinator.registry, fullMethod, protoregistry.ScopeStorage, protoregistry.OpMutator) - frame, err := proto.Marshal(&gitalypb.RemoveNamespaceRequest{ + frame, err := proto.Marshal(&gitalypb.RemoveAllRequest{ StorageName: conf.VirtualStorages[0].Name, - Name: "stub", }) require.NoError(t, err) @@ -1894,18 +1893,17 @@ func TestStreamDirectorStorageScope(t *testing.T) { require.Equal(t, primaryAddress, streamParams.Primary().Conn.Target(), "stream director didn't redirect to gitaly storage") - rewritten := gitalypb.RemoveNamespaceRequest{} + rewritten := gitalypb.RemoveAllRequest{} require.NoError(t, proto.Unmarshal(streamParams.Primary().Msg, &rewritten)) require.Equal(t, primaryGitaly.Storage, rewritten.StorageName, "stream director didn't rewrite storage") }) t.Run("accessor", func(t *testing.T) { - fullMethod := "/gitaly.NamespaceService/NamespaceExists" + fullMethod := "/gitaly.InternalGitaly/WalkRepos" requireScopeOperation(t, coordinator.registry, fullMethod, protoregistry.ScopeStorage, protoregistry.OpAccessor) - frame, err := proto.Marshal(&gitalypb.NamespaceExistsRequest{ + frame, err := proto.Marshal(&gitalypb.WalkReposRequest{ StorageName: conf.VirtualStorages[0].Name, - Name: "stub", }) require.NoError(t, err) @@ -1914,7 +1912,7 @@ func TestStreamDirectorStorageScope(t *testing.T) { require.Equal(t, primaryAddress, streamParams.Primary().Conn.Target(), "stream director didn't redirect to gitaly storage") - rewritten := gitalypb.RemoveNamespaceRequest{} + rewritten := gitalypb.WalkReposRequest{} require.NoError(t, proto.Unmarshal(streamParams.Primary().Msg, &rewritten)) require.Equal(t, primaryGitaly.Storage, rewritten.StorageName, "stream director didn't rewrite storage") }) @@ -1942,10 +1940,10 @@ func TestStreamDirectorStorageScopeError(t *testing.T) { protoregistry.GitalyProtoPreregistered, ) - frame, err := proto.Marshal(&gitalypb.RemoveNamespaceRequest{StorageName: "", Name: "stub"}) + frame, err := proto.Marshal(&gitalypb.WalkReposRequest{StorageName: ""}) require.NoError(t, err) - _, err = coordinator.StreamDirector(ctx, "/gitaly.NamespaceService/RemoveNamespace", &mockPeeker{frame}) + _, err = coordinator.StreamDirector(ctx, "/gitaly.InternalGitaly/WalkRepos", &mockPeeker{frame}) require.Error(t, err) result, ok := status.FromError(err) require.True(t, ok) @@ -1972,10 +1970,10 @@ func TestStreamDirectorStorageScopeError(t *testing.T) { protoregistry.GitalyProtoPreregistered, ) - frame, err := proto.Marshal(&gitalypb.RemoveNamespaceRequest{StorageName: "fake", Name: "stub"}) + frame, err := proto.Marshal(&gitalypb.WalkReposRequest{StorageName: "fake"}) require.NoError(t, err) - _, err = coordinator.StreamDirector(ctx, "/gitaly.NamespaceService/RemoveNamespace", &mockPeeker{frame}) + _, err = coordinator.StreamDirector(ctx, "/gitaly.InternalGitaly/WalkRepos", &mockPeeker{frame}) require.Error(t, err) result, ok := status.FromError(err) require.True(t, ok) @@ -2003,10 +2001,10 @@ func TestStreamDirectorStorageScopeError(t *testing.T) { protoregistry.GitalyProtoPreregistered, ) - fullMethod := "/gitaly.NamespaceService/NamespaceExists" + fullMethod := "/gitaly.InternalGitaly/WalkRepos" requireScopeOperation(t, coordinator.registry, fullMethod, protoregistry.ScopeStorage, protoregistry.OpAccessor) - frame, err := proto.Marshal(&gitalypb.NamespaceExistsRequest{StorageName: "fake", Name: "stub"}) + frame, err := proto.Marshal(&gitalypb.WalkReposRequest{StorageName: "fake"}) require.NoError(t, err) _, err = coordinator.StreamDirector(ctx, fullMethod, &mockPeeker{frame}) @@ -2035,10 +2033,10 @@ func TestStreamDirectorStorageScopeError(t *testing.T) { protoregistry.GitalyProtoPreregistered, ) - fullMethod := "/gitaly.NamespaceService/RemoveNamespace" + fullMethod := "/gitaly.RepositoryService/RemoveAll" requireScopeOperation(t, coordinator.registry, fullMethod, protoregistry.ScopeStorage, protoregistry.OpMutator) - frame, err := proto.Marshal(&gitalypb.RemoveNamespaceRequest{StorageName: "fake", Name: "stub"}) + frame, err := proto.Marshal(&gitalypb.RemoveAllRequest{StorageName: "fake"}) require.NoError(t, err) _, err = coordinator.StreamDirector(ctx, fullMethod, &mockPeeker{frame}) diff --git a/proto/go/gitalypb/namespace.pb.go b/proto/go/gitalypb/namespace.pb.go deleted file mode 100644 index cd77ca6bb..000000000 --- a/proto/go/gitalypb/namespace.pb.go +++ /dev/null @@ -1,658 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc v4.23.1 -// source: namespace.proto - -package gitalypb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// AddNamespaceRequest ... -type AddNamespaceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // storage_name ... - StorageName string `protobuf:"bytes,1,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"` - // name ... - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *AddNamespaceRequest) Reset() { - *x = AddNamespaceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddNamespaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddNamespaceRequest) ProtoMessage() {} - -func (x *AddNamespaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddNamespaceRequest.ProtoReflect.Descriptor instead. -func (*AddNamespaceRequest) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{0} -} - -func (x *AddNamespaceRequest) GetStorageName() string { - if x != nil { - return x.StorageName - } - return "" -} - -func (x *AddNamespaceRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// RemoveNamespaceRequest ... -type RemoveNamespaceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // storage_name ... - StorageName string `protobuf:"bytes,1,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"` - // name ... - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *RemoveNamespaceRequest) Reset() { - *x = RemoveNamespaceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveNamespaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveNamespaceRequest) ProtoMessage() {} - -func (x *RemoveNamespaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveNamespaceRequest.ProtoReflect.Descriptor instead. -func (*RemoveNamespaceRequest) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{1} -} - -func (x *RemoveNamespaceRequest) GetStorageName() string { - if x != nil { - return x.StorageName - } - return "" -} - -func (x *RemoveNamespaceRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// RenameNamespaceRequest ... -type RenameNamespaceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // storage_name ... - StorageName string `protobuf:"bytes,1,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"` - // from ... - From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"` - // to ... - To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` -} - -func (x *RenameNamespaceRequest) Reset() { - *x = RenameNamespaceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RenameNamespaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RenameNamespaceRequest) ProtoMessage() {} - -func (x *RenameNamespaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RenameNamespaceRequest.ProtoReflect.Descriptor instead. -func (*RenameNamespaceRequest) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{2} -} - -func (x *RenameNamespaceRequest) GetStorageName() string { - if x != nil { - return x.StorageName - } - return "" -} - -func (x *RenameNamespaceRequest) GetFrom() string { - if x != nil { - return x.From - } - return "" -} - -func (x *RenameNamespaceRequest) GetTo() string { - if x != nil { - return x.To - } - return "" -} - -// NamespaceExistsRequest ... -type NamespaceExistsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // storage_name ... - StorageName string `protobuf:"bytes,1,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"` - // name ... - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *NamespaceExistsRequest) Reset() { - *x = NamespaceExistsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamespaceExistsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamespaceExistsRequest) ProtoMessage() {} - -func (x *NamespaceExistsRequest) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamespaceExistsRequest.ProtoReflect.Descriptor instead. -func (*NamespaceExistsRequest) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{3} -} - -func (x *NamespaceExistsRequest) GetStorageName() string { - if x != nil { - return x.StorageName - } - return "" -} - -func (x *NamespaceExistsRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// NamespaceExistsResponse ... -type NamespaceExistsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // exists ... - Exists bool `protobuf:"varint,1,opt,name=exists,proto3" json:"exists,omitempty"` -} - -func (x *NamespaceExistsResponse) Reset() { - *x = NamespaceExistsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamespaceExistsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamespaceExistsResponse) ProtoMessage() {} - -func (x *NamespaceExistsResponse) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamespaceExistsResponse.ProtoReflect.Descriptor instead. -func (*NamespaceExistsResponse) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{4} -} - -func (x *NamespaceExistsResponse) GetExists() bool { - if x != nil { - return x.Exists - } - return false -} - -// AddNamespaceResponse ... -type AddNamespaceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AddNamespaceResponse) Reset() { - *x = AddNamespaceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddNamespaceResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddNamespaceResponse) ProtoMessage() {} - -func (x *AddNamespaceResponse) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddNamespaceResponse.ProtoReflect.Descriptor instead. -func (*AddNamespaceResponse) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{5} -} - -// RemoveNamespaceResponse ... -type RemoveNamespaceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RemoveNamespaceResponse) Reset() { - *x = RemoveNamespaceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveNamespaceResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveNamespaceResponse) ProtoMessage() {} - -func (x *RemoveNamespaceResponse) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveNamespaceResponse.ProtoReflect.Descriptor instead. -func (*RemoveNamespaceResponse) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{6} -} - -// RenameNamespaceResponse ... -type RenameNamespaceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RenameNamespaceResponse) Reset() { - *x = RenameNamespaceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_namespace_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RenameNamespaceResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RenameNamespaceResponse) ProtoMessage() {} - -func (x *RenameNamespaceResponse) ProtoReflect() protoreflect.Message { - mi := &file_namespace_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RenameNamespaceResponse.ProtoReflect.Descriptor instead. -func (*RenameNamespaceResponse) Descriptor() ([]byte, []int) { - return file_namespace_proto_rawDescGZIP(), []int{7} -} - -var File_namespace_proto protoreflect.FileDescriptor - -var file_namespace_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x06, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x1a, 0x0a, 0x6c, 0x69, 0x6e, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x4e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0c, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x04, 0x88, 0xc6, 0x2c, 0x01, 0x52, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, 0x16, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0x88, 0xc6, 0x2c, 0x01, 0x52, - 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x22, 0x65, 0x0a, 0x16, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0c, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x04, 0x88, 0xc6, 0x2c, 0x01, 0x52, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x55, 0x0a, 0x16, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x27, 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0x88, 0xc6, 0x2c, 0x01, 0x52, 0x0b, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x31, - 0x0a, 0x17, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x69, - 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x22, 0x16, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0x81, 0x03, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x1b, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x64, - 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1c, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x4e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x08, 0xfa, 0x97, 0x28, 0x04, 0x08, 0x01, 0x10, 0x02, 0x12, 0x5c, 0x0a, 0x0f, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1e, 0x2e, 0x67, - 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, - 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xfa, - 0x97, 0x28, 0x04, 0x08, 0x01, 0x10, 0x02, 0x12, 0x5c, 0x0a, 0x0f, 0x52, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, - 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, - 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xfa, 0x97, 0x28, - 0x04, 0x08, 0x01, 0x10, 0x02, 0x12, 0x5c, 0x0a, 0x0f, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, - 0x79, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, - 0x79, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xfa, 0x97, 0x28, 0x04, 0x08, - 0x02, 0x10, 0x02, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x69, 0x74, - 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, - 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_namespace_proto_rawDescOnce sync.Once - file_namespace_proto_rawDescData = file_namespace_proto_rawDesc -) - -func file_namespace_proto_rawDescGZIP() []byte { - file_namespace_proto_rawDescOnce.Do(func() { - file_namespace_proto_rawDescData = protoimpl.X.CompressGZIP(file_namespace_proto_rawDescData) - }) - return file_namespace_proto_rawDescData -} - -var file_namespace_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_namespace_proto_goTypes = []interface{}{ - (*AddNamespaceRequest)(nil), // 0: gitaly.AddNamespaceRequest - (*RemoveNamespaceRequest)(nil), // 1: gitaly.RemoveNamespaceRequest - (*RenameNamespaceRequest)(nil), // 2: gitaly.RenameNamespaceRequest - (*NamespaceExistsRequest)(nil), // 3: gitaly.NamespaceExistsRequest - (*NamespaceExistsResponse)(nil), // 4: gitaly.NamespaceExistsResponse - (*AddNamespaceResponse)(nil), // 5: gitaly.AddNamespaceResponse - (*RemoveNamespaceResponse)(nil), // 6: gitaly.RemoveNamespaceResponse - (*RenameNamespaceResponse)(nil), // 7: gitaly.RenameNamespaceResponse -} -var file_namespace_proto_depIdxs = []int32{ - 0, // 0: gitaly.NamespaceService.AddNamespace:input_type -> gitaly.AddNamespaceRequest - 1, // 1: gitaly.NamespaceService.RemoveNamespace:input_type -> gitaly.RemoveNamespaceRequest - 2, // 2: gitaly.NamespaceService.RenameNamespace:input_type -> gitaly.RenameNamespaceRequest - 3, // 3: gitaly.NamespaceService.NamespaceExists:input_type -> gitaly.NamespaceExistsRequest - 5, // 4: gitaly.NamespaceService.AddNamespace:output_type -> gitaly.AddNamespaceResponse - 6, // 5: gitaly.NamespaceService.RemoveNamespace:output_type -> gitaly.RemoveNamespaceResponse - 7, // 6: gitaly.NamespaceService.RenameNamespace:output_type -> gitaly.RenameNamespaceResponse - 4, // 7: gitaly.NamespaceService.NamespaceExists:output_type -> gitaly.NamespaceExistsResponse - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_namespace_proto_init() } -func file_namespace_proto_init() { - if File_namespace_proto != nil { - return - } - file_lint_proto_init() - if !protoimpl.UnsafeEnabled { - file_namespace_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddNamespaceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_namespace_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveNamespaceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_namespace_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RenameNamespaceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_namespace_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamespaceExistsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_namespace_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamespaceExistsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_namespace_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddNamespaceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_namespace_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveNamespaceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_namespace_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RenameNamespaceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_namespace_proto_rawDesc, - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_namespace_proto_goTypes, - DependencyIndexes: file_namespace_proto_depIdxs, - MessageInfos: file_namespace_proto_msgTypes, - }.Build() - File_namespace_proto = out.File - file_namespace_proto_rawDesc = nil - file_namespace_proto_goTypes = nil - file_namespace_proto_depIdxs = nil -} diff --git a/proto/go/gitalypb/namespace_grpc.pb.go b/proto/go/gitalypb/namespace_grpc.pb.go deleted file mode 100644 index 64404c984..000000000 --- a/proto/go/gitalypb/namespace_grpc.pb.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v4.23.1 -// source: namespace.proto - -package gitalypb - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// NamespaceServiceClient is the client API for NamespaceService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type NamespaceServiceClient interface { - // AddNamespace ... - AddNamespace(ctx context.Context, in *AddNamespaceRequest, opts ...grpc.CallOption) (*AddNamespaceResponse, error) - // RemoveNamespace ... - RemoveNamespace(ctx context.Context, in *RemoveNamespaceRequest, opts ...grpc.CallOption) (*RemoveNamespaceResponse, error) - // RenameNamespace ... - RenameNamespace(ctx context.Context, in *RenameNamespaceRequest, opts ...grpc.CallOption) (*RenameNamespaceResponse, error) - // NamespaceExists ... - NamespaceExists(ctx context.Context, in *NamespaceExistsRequest, opts ...grpc.CallOption) (*NamespaceExistsResponse, error) -} - -type namespaceServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewNamespaceServiceClient(cc grpc.ClientConnInterface) NamespaceServiceClient { - return &namespaceServiceClient{cc} -} - -func (c *namespaceServiceClient) AddNamespace(ctx context.Context, in *AddNamespaceRequest, opts ...grpc.CallOption) (*AddNamespaceResponse, error) { - out := new(AddNamespaceResponse) - err := c.cc.Invoke(ctx, "/gitaly.NamespaceService/AddNamespace", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *namespaceServiceClient) RemoveNamespace(ctx context.Context, in *RemoveNamespaceRequest, opts ...grpc.CallOption) (*RemoveNamespaceResponse, error) { - out := new(RemoveNamespaceResponse) - err := c.cc.Invoke(ctx, "/gitaly.NamespaceService/RemoveNamespace", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *namespaceServiceClient) RenameNamespace(ctx context.Context, in *RenameNamespaceRequest, opts ...grpc.CallOption) (*RenameNamespaceResponse, error) { - out := new(RenameNamespaceResponse) - err := c.cc.Invoke(ctx, "/gitaly.NamespaceService/RenameNamespace", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *namespaceServiceClient) NamespaceExists(ctx context.Context, in *NamespaceExistsRequest, opts ...grpc.CallOption) (*NamespaceExistsResponse, error) { - out := new(NamespaceExistsResponse) - err := c.cc.Invoke(ctx, "/gitaly.NamespaceService/NamespaceExists", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// NamespaceServiceServer is the server API for NamespaceService service. -// All implementations must embed UnimplementedNamespaceServiceServer -// for forward compatibility -type NamespaceServiceServer interface { - // AddNamespace ... - AddNamespace(context.Context, *AddNamespaceRequest) (*AddNamespaceResponse, error) - // RemoveNamespace ... - RemoveNamespace(context.Context, *RemoveNamespaceRequest) (*RemoveNamespaceResponse, error) - // RenameNamespace ... - RenameNamespace(context.Context, *RenameNamespaceRequest) (*RenameNamespaceResponse, error) - // NamespaceExists ... - NamespaceExists(context.Context, *NamespaceExistsRequest) (*NamespaceExistsResponse, error) - mustEmbedUnimplementedNamespaceServiceServer() -} - -// UnimplementedNamespaceServiceServer must be embedded to have forward compatible implementations. -type UnimplementedNamespaceServiceServer struct { -} - -func (UnimplementedNamespaceServiceServer) AddNamespace(context.Context, *AddNamespaceRequest) (*AddNamespaceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddNamespace not implemented") -} -func (UnimplementedNamespaceServiceServer) RemoveNamespace(context.Context, *RemoveNamespaceRequest) (*RemoveNamespaceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveNamespace not implemented") -} -func (UnimplementedNamespaceServiceServer) RenameNamespace(context.Context, *RenameNamespaceRequest) (*RenameNamespaceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RenameNamespace not implemented") -} -func (UnimplementedNamespaceServiceServer) NamespaceExists(context.Context, *NamespaceExistsRequest) (*NamespaceExistsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NamespaceExists not implemented") -} -func (UnimplementedNamespaceServiceServer) mustEmbedUnimplementedNamespaceServiceServer() {} - -// UnsafeNamespaceServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to NamespaceServiceServer will -// result in compilation errors. -type UnsafeNamespaceServiceServer interface { - mustEmbedUnimplementedNamespaceServiceServer() -} - -func RegisterNamespaceServiceServer(s grpc.ServiceRegistrar, srv NamespaceServiceServer) { - s.RegisterService(&NamespaceService_ServiceDesc, srv) -} - -func _NamespaceService_AddNamespace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddNamespaceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NamespaceServiceServer).AddNamespace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gitaly.NamespaceService/AddNamespace", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NamespaceServiceServer).AddNamespace(ctx, req.(*AddNamespaceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _NamespaceService_RemoveNamespace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveNamespaceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NamespaceServiceServer).RemoveNamespace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gitaly.NamespaceService/RemoveNamespace", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NamespaceServiceServer).RemoveNamespace(ctx, req.(*RemoveNamespaceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _NamespaceService_RenameNamespace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RenameNamespaceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NamespaceServiceServer).RenameNamespace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gitaly.NamespaceService/RenameNamespace", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NamespaceServiceServer).RenameNamespace(ctx, req.(*RenameNamespaceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _NamespaceService_NamespaceExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NamespaceExistsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NamespaceServiceServer).NamespaceExists(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gitaly.NamespaceService/NamespaceExists", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NamespaceServiceServer).NamespaceExists(ctx, req.(*NamespaceExistsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// NamespaceService_ServiceDesc is the grpc.ServiceDesc for NamespaceService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var NamespaceService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "gitaly.NamespaceService", - HandlerType: (*NamespaceServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AddNamespace", - Handler: _NamespaceService_AddNamespace_Handler, - }, - { - MethodName: "RemoveNamespace", - Handler: _NamespaceService_RemoveNamespace_Handler, - }, - { - MethodName: "RenameNamespace", - Handler: _NamespaceService_RenameNamespace_Handler, - }, - { - MethodName: "NamespaceExists", - Handler: _NamespaceService_NamespaceExists_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "namespace.proto", -} diff --git a/proto/go/gitalypb/protolist.go b/proto/go/gitalypb/protolist.go index 7a7aac0eb..30e8c28a3 100644 --- a/proto/go/gitalypb/protolist.go +++ b/proto/go/gitalypb/protolist.go @@ -14,7 +14,6 @@ var GitalyProtos = []string{ "internal.proto", "lint.proto", "log.proto", - "namespace.proto", "objectpool.proto", "operations.proto", "packfile.proto", diff --git a/proto/namespace.proto b/proto/namespace.proto deleted file mode 100644 index 3c3eb7569..000000000 --- a/proto/namespace.proto +++ /dev/null @@ -1,98 +0,0 @@ -syntax = "proto3"; - -package gitaly; - -import "lint.proto"; - -option go_package = "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"; - -// NamespaceService is a service which provides RPCs to manage namespaces of a -// storage. Namespaces had been used before Gitaly migrated to hashed storages -// and shouldn't be used nowadays anymore. -service NamespaceService { - - // AddNamespace ... - rpc AddNamespace(AddNamespaceRequest) returns (AddNamespaceResponse) { - option (op_type) = { - op: MUTATOR - scope_level: STORAGE, - }; - } - - // RemoveNamespace ... - rpc RemoveNamespace(RemoveNamespaceRequest) returns (RemoveNamespaceResponse) { - option (op_type) = { - op: MUTATOR - scope_level: STORAGE, - }; - } - - // RenameNamespace ... - rpc RenameNamespace(RenameNamespaceRequest) returns (RenameNamespaceResponse) { - option (op_type) = { - op: MUTATOR - scope_level: STORAGE, - }; - } - - // NamespaceExists ... - rpc NamespaceExists(NamespaceExistsRequest) returns (NamespaceExistsResponse) { - option (op_type) = { - op: ACCESSOR - scope_level: STORAGE, - }; - } - -} - -// AddNamespaceRequest ... -message AddNamespaceRequest { - // storage_name ... - string storage_name = 1 [(storage)=true]; - // name ... - string name = 2; -} - -// RemoveNamespaceRequest ... -message RemoveNamespaceRequest { - // storage_name ... - string storage_name = 1 [(storage)=true]; - // name ... - string name = 2; -} - -// RenameNamespaceRequest ... -message RenameNamespaceRequest { - // storage_name ... - string storage_name = 1 [(storage)=true]; - // from ... - string from = 2; - // to ... - string to = 3; -} - -// NamespaceExistsRequest ... -message NamespaceExistsRequest { - // storage_name ... - string storage_name = 1 [(storage)=true]; - // name ... - string name = 2; -} - -// NamespaceExistsResponse ... -message NamespaceExistsResponse { - // exists ... - bool exists = 1; -} - -// AddNamespaceResponse ... -message AddNamespaceResponse { -} - -// RemoveNamespaceResponse ... -message RemoveNamespaceResponse { -} - -// RenameNamespaceResponse ... -message RenameNamespaceResponse { -} |