diff options
author | James Fargher <proglottis@gmail.com> | 2023-06-19 03:21:34 +0300 |
---|---|---|
committer | James Fargher <proglottis@gmail.com> | 2023-06-19 03:21:34 +0300 |
commit | b967c1ee24740ab58d8111f0f46bd3fcfa3467a5 (patch) | |
tree | 86ded85a31b0e12650989bb852930c741aa18a18 | |
parent | 37a7580203ae39c3723644643a0943905976446f (diff) | |
parent | a92e31c464cf74ee6aeb79b08abe96c60e58130b (diff) |
Merge branch 'remove_backup_repos' into 'master'
Remove BackupRepos RPC
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5931
Merged-by: James Fargher <proglottis@gmail.com>
Approved-by: Pavlo Strokov <pstrokov@gitlab.com>
Co-authored-by: James Fargher <jfargher@gitlab.com>
-rw-r--r-- | internal/gitaly/service/internalgitaly/backup_repos.go | 84 | ||||
-rw-r--r-- | internal/gitaly/service/internalgitaly/backup_repos_test.go | 165 | ||||
-rw-r--r-- | internal/gitaly/service/internalgitaly/server.go | 20 | ||||
-rw-r--r-- | internal/gitaly/service/internalgitaly/walkrepos_test.go | 10 | ||||
-rw-r--r-- | internal/gitaly/service/setup/register.go | 3 | ||||
-rw-r--r-- | proto/go/gitalypb/internal.pb.go | 289 | ||||
-rw-r--r-- | proto/go/gitalypb/internal_grpc.pb.go | 74 | ||||
-rw-r--r-- | proto/internal.proto | 35 |
8 files changed, 36 insertions, 644 deletions
diff --git a/internal/gitaly/service/internalgitaly/backup_repos.go b/internal/gitaly/service/internalgitaly/backup_repos.go deleted file mode 100644 index 7fa56d583..000000000 --- a/internal/gitaly/service/internalgitaly/backup_repos.go +++ /dev/null @@ -1,84 +0,0 @@ -package internalgitaly - -import ( - "errors" - "fmt" - "io" - - "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" - "gitlab.com/gitlab-org/gitaly/v16/internal/backup" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" - "gitlab.com/gitlab-org/gitaly/v16/internal/structerr" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" -) - -func (s server) BackupRepos(stream gitalypb.InternalGitaly_BackupReposServer) error { - ctx := stream.Context() - - request, err := stream.Recv() - if err != nil { - return fmt.Errorf("backup repos: first request: %w", err) - } - - if err := validateBackupReposRequest(request); err != nil { - return structerr.NewInvalidArgument("backup repos: first request: %w", err) - } - - header := request.GetHeader() - backupID := header.GetBackupId() - - sink, err := backup.ResolveSink(ctx, header.GetStorageUrl()) - if err != nil { - return structerr.NewInvalidArgument("backup repos: resolve sink: %w", err) - } - - locator, err := backup.ResolveLocator("pointer", sink) - if err != nil { - return structerr.NewInvalidArgument("backup repos: resolve locator: %w", err) - } - - manager := backup.NewManagerLocal(sink, locator, s.locator, s.gitCmdFactory, s.catfileCache, s.txManager, backupID) - pipeline := backup.NewLoggingPipeline(ctxlogrus.Extract(ctx)) - - for { - for _, repo := range request.GetRepositories() { - pipeline.Handle(ctx, backup.NewCreateCommand( - manager, - storage.ServerInfo{}, - repo, - false, - )) - } - - var err error - request, err = stream.Recv() - if errors.Is(err, io.EOF) { - break - } else if err != nil { - return fmt.Errorf("backup repos: receive: %w", err) - } - } - - if err := pipeline.Done(); err != nil { - return fmt.Errorf("backup repos: %w", err) - } - - if err := stream.SendAndClose(&gitalypb.BackupReposResponse{}); err != nil { - return fmt.Errorf("backup repos: %w", err) - } - - return nil -} - -func validateBackupReposRequest(req *gitalypb.BackupReposRequest) error { - header := req.Header - switch { - case header == nil: - return fmt.Errorf("empty Header") - case header.GetBackupId() == "": - return fmt.Errorf("empty BackupId") - case header.GetStorageUrl() == "": - return fmt.Errorf("empty StorageUrl") - } - return nil -} diff --git a/internal/gitaly/service/internalgitaly/backup_repos_test.go b/internal/gitaly/service/internalgitaly/backup_repos_test.go deleted file mode 100644 index 8adb11524..000000000 --- a/internal/gitaly/service/internalgitaly/backup_repos_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package internalgitaly - -import ( - "context" - "path/filepath" - "strings" - "testing" - - "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/v16/internal/backup" - "gitlab.com/gitlab-org/gitaly/v16/internal/git" - "gitlab.com/gitlab-org/gitaly/v16/internal/git/catfile" - "gitlab.com/gitlab-org/gitaly/v16/internal/git/gittest" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/transaction" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper/testcfg" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func TestServerBackupRepos(t *testing.T) { - t.Parallel() - - const backupID = "abc123" - - type setupData struct { - requests []*gitalypb.BackupReposRequest - expectedRepos []*gitalypb.Repository - } - - for _, tc := range []struct { - desc string - setup func(tb testing.TB, ctx context.Context, cfg config.Cfg, storageURL string) setupData - expectedErr error - }{ - { - desc: "missing header", - setup: func(tb testing.TB, ctx context.Context, cfg config.Cfg, storageURL string) setupData { - return setupData{requests: []*gitalypb.BackupReposRequest{{}}} - }, - expectedErr: status.Error(codes.InvalidArgument, `backup repos: first request: empty Header`), - }, - { - desc: "missing backup ID", - setup: func(tb testing.TB, ctx context.Context, cfg config.Cfg, storageURL string) setupData { - return setupData{ - requests: []*gitalypb.BackupReposRequest{{Header: &gitalypb.BackupReposRequest_Header{}}}, - } - }, - expectedErr: status.Error(codes.InvalidArgument, `backup repos: first request: empty BackupId`), - }, - { - desc: "missing storage URL", - setup: func(tb testing.TB, ctx context.Context, cfg config.Cfg, storageURL string) setupData { - return setupData{ - requests: []*gitalypb.BackupReposRequest{{Header: &gitalypb.BackupReposRequest_Header{ - BackupId: backupID, - }}}, - } - }, - expectedErr: status.Error(codes.InvalidArgument, `backup repos: first request: empty StorageUrl`), - }, - { - desc: "invalid storage URL", - setup: func(tb testing.TB, ctx context.Context, cfg config.Cfg, storageURL string) setupData { - return setupData{ - requests: []*gitalypb.BackupReposRequest{ - { - Header: &gitalypb.BackupReposRequest_Header{ - BackupId: backupID, - StorageUrl: "%invalid%", - }, - }, - }, - } - }, - expectedErr: status.Error(codes.InvalidArgument, `backup repos: resolve sink: parse "%invalid%": invalid URL escape "%in"`), - }, - { - desc: "success", - setup: func(tb testing.TB, ctx context.Context, cfg config.Cfg, storageURL string) setupData { - var repos []*gitalypb.Repository - for i := 0; i < 5; i++ { - repo, repoPath := gittest.CreateRepository(tb, ctx, cfg, gittest.CreateRepositoryConfig{ - SkipCreationViaService: true, - }) - gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(git.DefaultBranch)) - repos = append(repos, repo) - } - - return setupData{ - requests: []*gitalypb.BackupReposRequest{ - { - Header: &gitalypb.BackupReposRequest_Header{ - BackupId: backupID, - StorageUrl: storageURL, - }, - Repositories: repos[:len(repos)/2], - }, - { - Repositories: repos[len(repos)/2:], - }, - }, - expectedRepos: repos, - } - }, - }, - } { - tc := tc - - t.Run(tc.desc, func(t *testing.T) { - t.Parallel() - - ctx := testhelper.Context(t) - cfg := testcfg.Build(t) - storageURL := testhelper.TempDir(t) - setupData := tc.setup(t, ctx, cfg, storageURL) - - catfileCache := catfile.NewCache(cfg) - t.Cleanup(catfileCache.Stop) - - txManager := transaction.NewTrackingManager() - - srv := NewServer( - cfg.Storages, - config.NewLocator(cfg), - gittest.NewCommandFactory(t, cfg), - catfileCache, - txManager, - ) - - client := setupInternalGitalyService(t, cfg, srv) - - stream, err := client.BackupRepos(ctx) - require.NoError(t, err) - - for _, req := range setupData.requests { - err = stream.Send(req) - require.NoError(t, err) - } - - _, err = stream.CloseAndRecv() - if tc.expectedErr == nil { - require.NoError(t, err) - } else { - require.Equal(t, tc.expectedErr, err) - } - - t.Log(storageURL) - sink, err := backup.ResolveSink(ctx, storageURL) - require.NoError(t, err) - - for _, repo := range setupData.expectedRepos { - relativePath := strings.TrimSuffix(repo.GetRelativePath(), ".git") - bundlePath := filepath.Join(relativePath, backupID, "001.bundle") - - r, err := sink.GetReader(ctx, bundlePath) - require.NoError(t, err) - testhelper.MustClose(t, r) - } - }) - } -} diff --git a/internal/gitaly/service/internalgitaly/server.go b/internal/gitaly/service/internalgitaly/server.go index 41231fcb1..c7799e5c6 100644 --- a/internal/gitaly/service/internalgitaly/server.go +++ b/internal/gitaly/service/internalgitaly/server.go @@ -1,36 +1,24 @@ package internalgitaly import ( - "gitlab.com/gitlab-org/gitaly/v16/internal/git" - "gitlab.com/gitlab-org/gitaly/v16/internal/git/catfile" "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/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" ) type server struct { gitalypb.UnimplementedInternalGitalyServer - storages []config.Storage - locator storage.Locator - gitCmdFactory git.CommandFactory - catfileCache catfile.Cache - txManager transaction.Manager + storages []config.Storage + locator storage.Locator } // NewServer return an instance of the Gitaly service. func NewServer( storages []config.Storage, locator storage.Locator, - gitCmdFactory git.CommandFactory, - catfileCache catfile.Cache, - txManager transaction.Manager, ) gitalypb.InternalGitalyServer { return &server{ - storages: storages, - locator: locator, - gitCmdFactory: gitCmdFactory, - catfileCache: catfileCache, - txManager: txManager, + storages: storages, + locator: locator, } } diff --git a/internal/gitaly/service/internalgitaly/walkrepos_test.go b/internal/gitaly/service/internalgitaly/walkrepos_test.go index 067a7c1ee..777368c2a 100644 --- a/internal/gitaly/service/internalgitaly/walkrepos_test.go +++ b/internal/gitaly/service/internalgitaly/walkrepos_test.go @@ -9,11 +9,9 @@ import ( "time" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitaly/v16/internal/git/catfile" "gitlab.com/gitlab-org/gitaly/v16/internal/git/gittest" "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/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/v16/internal/structerr" "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper/testcfg" @@ -72,11 +70,6 @@ func TestWalkRepos(t *testing.T) { os.Chtimes(testRepo2Path, time.Now(), modifiedDate), ) - catfileCache := catfile.NewCache(cfg) - t.Cleanup(catfileCache.Stop) - - txManager := transaction.NewTrackingManager() - // to test a directory being deleted during a walk, we must delete a directory after // the file walk has started. To achieve that, we wrap the server to pass down a wrapped // stream that allows us to hook in to stream responses. We then delete 'b' when @@ -85,9 +78,6 @@ func TestWalkRepos(t *testing.T) { srv := NewServer( []config.Storage{{Name: storageName, Path: storageRoot}}, config.NewLocator(cfg), - gittest.NewCommandFactory(t, cfg), - catfileCache, - txManager, ) wsrv := &serverWrapper{ srv, diff --git a/internal/gitaly/service/setup/register.go b/internal/gitaly/service/setup/register.go index dac88ae51..a9a50863f 100644 --- a/internal/gitaly/service/setup/register.go +++ b/internal/gitaly/service/setup/register.go @@ -148,9 +148,6 @@ func RegisterAll(srv *grpc.Server, deps *service.Dependencies) { gitalypb.RegisterInternalGitalyServer(srv, internalgitaly.NewServer( deps.GetCfg().Storages, deps.GetLocator(), - deps.GetGitCmdFactory(), - deps.GetCatfileCache(), - deps.GetTxManager(), )) healthpb.RegisterHealthServer(srv, health.NewServer()) diff --git a/proto/go/gitalypb/internal.pb.go b/proto/go/gitalypb/internal.pb.go index 2e509afd1..6be14c232 100644 --- a/proto/go/gitalypb/internal.pb.go +++ b/proto/go/gitalypb/internal.pb.go @@ -130,165 +130,6 @@ func (x *WalkReposResponse) GetModificationTime() *timestamppb.Timestamp { return nil } -// BackupReposRequest contains request parameters for the BackupRepos RPC. -type BackupReposRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // For each request stream there must be first a request with a header - // containing details about the backups to perform. - Header *BackupReposRequest_Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - // Repositories to have a backups triggered. - Repositories []*Repository `protobuf:"bytes,2,rep,name=repositories,proto3" json:"repositories,omitempty"` -} - -func (x *BackupReposRequest) Reset() { - *x = BackupReposRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_internal_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BackupReposRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BackupReposRequest) ProtoMessage() {} - -func (x *BackupReposRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_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 BackupReposRequest.ProtoReflect.Descriptor instead. -func (*BackupReposRequest) Descriptor() ([]byte, []int) { - return file_internal_proto_rawDescGZIP(), []int{2} -} - -func (x *BackupReposRequest) GetHeader() *BackupReposRequest_Header { - if x != nil { - return x.Header - } - return nil -} - -func (x *BackupReposRequest) GetRepositories() []*Repository { - if x != nil { - return x.Repositories - } - return nil -} - -// BackupReposResponse contains response parameters for the BackupRepos RPC. -type BackupReposResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *BackupReposResponse) Reset() { - *x = BackupReposResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_internal_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BackupReposResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BackupReposResponse) ProtoMessage() {} - -func (x *BackupReposResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_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 BackupReposResponse.ProtoReflect.Descriptor instead. -func (*BackupReposResponse) Descriptor() ([]byte, []int) { - return file_internal_proto_rawDescGZIP(), []int{3} -} - -// Header contains information to create the backups and must be sent in the -// first message. -type BackupReposRequest_Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // BackupId determines which collective backup these repository backups will - // be part of. Must be sent in first message. - BackupId string `protobuf:"bytes,1,opt,name=backup_id,json=backupId,proto3" json:"backup_id,omitempty"` - // StorageUrl is the object-storage URL where the backups will be stored. - // See https://gocloud.dev/howto/blob/ and https://gocloud.dev/concepts/urls/ - StorageUrl string `protobuf:"bytes,2,opt,name=storage_url,json=storageUrl,proto3" json:"storage_url,omitempty"` -} - -func (x *BackupReposRequest_Header) Reset() { - *x = BackupReposRequest_Header{} - if protoimpl.UnsafeEnabled { - mi := &file_internal_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BackupReposRequest_Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BackupReposRequest_Header) ProtoMessage() {} - -func (x *BackupReposRequest_Header) ProtoReflect() protoreflect.Message { - mi := &file_internal_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 BackupReposRequest_Header.ProtoReflect.Descriptor instead. -func (*BackupReposRequest_Header) Descriptor() ([]byte, []int) { - return file_internal_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *BackupReposRequest_Header) GetBackupId() string { - if x != nil { - return x.BackupId - } - return "" -} - -func (x *BackupReposRequest_Header) GetStorageUrl() string { - if x != nil { - return x.StorageUrl - } - return "" -} - var File_internal_proto protoreflect.FileDescriptor var file_internal_proto_rawDesc = []byte{ @@ -296,46 +137,25 @@ var file_internal_proto_rawDesc = []byte{ 0x12, 0x06, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x6c, 0x69, 0x6e, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x10, 0x57, 0x61, 0x6c, 0x6b, 0x52, 0x65, 0x70, 0x6f, 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, - 0x22, 0x81, 0x01, 0x0a, 0x11, 0x57, 0x61, 0x6c, 0x6b, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x47, 0x0a, 0x11, 0x6d, - 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x10, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x69, 0x6d, 0x65, 0x22, 0xd5, 0x01, 0x0a, 0x12, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, - 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x06, 0x68, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x69, - 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6f, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, - 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, - 0x42, 0x04, 0x98, 0xc6, 0x2c, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, - 0x72, 0x69, 0x65, 0x73, 0x1a, 0x46, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1b, - 0x0a, 0x09, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x15, 0x0a, 0x13, - 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x32, 0xb0, 0x01, 0x0a, 0x0e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x47, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x12, 0x4c, 0x0a, 0x09, 0x57, 0x61, 0x6c, 0x6b, 0x52, 0x65, - 0x70, 0x6f, 0x73, 0x12, 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x57, 0x61, 0x6c, - 0x6b, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, - 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x57, 0x61, 0x6c, 0x6b, 0x52, 0x65, 0x70, 0x6f, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xfa, 0x97, 0x28, 0x04, 0x08, 0x02, - 0x10, 0x02, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x0b, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, 0x65, - 0x70, 0x6f, 0x73, 0x12, 0x1a, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, - 0x6b, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1b, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x52, - 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, - 0x28, 0x02, 0x08, 0x02, 0x28, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b, 0x0a, 0x10, 0x57, 0x61, 0x6c, 0x6b, 0x52, 0x65, 0x70, + 0x6f, 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, 0x22, 0x81, 0x01, 0x0a, 0x11, 0x57, 0x61, 0x6c, 0x6b, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, + 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x47, 0x0a, + 0x11, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x32, 0x5e, 0x0a, 0x0e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x47, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x12, 0x4c, 0x0a, 0x09, 0x57, 0x61, 0x6c, 0x6b, + 0x52, 0x65, 0x70, 0x6f, 0x73, 0x12, 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x57, + 0x61, 0x6c, 0x6b, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x19, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x57, 0x61, 0x6c, 0x6b, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xfa, 0x97, 0x28, 0x04, + 0x08, 0x02, 0x10, 0x02, 0x30, 0x01, 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, @@ -354,29 +174,21 @@ func file_internal_proto_rawDescGZIP() []byte { return file_internal_proto_rawDescData } -var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_internal_proto_goTypes = []interface{}{ - (*WalkReposRequest)(nil), // 0: gitaly.WalkReposRequest - (*WalkReposResponse)(nil), // 1: gitaly.WalkReposResponse - (*BackupReposRequest)(nil), // 2: gitaly.BackupReposRequest - (*BackupReposResponse)(nil), // 3: gitaly.BackupReposResponse - (*BackupReposRequest_Header)(nil), // 4: gitaly.BackupReposRequest.Header - (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp - (*Repository)(nil), // 6: gitaly.Repository + (*WalkReposRequest)(nil), // 0: gitaly.WalkReposRequest + (*WalkReposResponse)(nil), // 1: gitaly.WalkReposResponse + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp } var file_internal_proto_depIdxs = []int32{ - 5, // 0: gitaly.WalkReposResponse.modification_time:type_name -> google.protobuf.Timestamp - 4, // 1: gitaly.BackupReposRequest.header:type_name -> gitaly.BackupReposRequest.Header - 6, // 2: gitaly.BackupReposRequest.repositories:type_name -> gitaly.Repository - 0, // 3: gitaly.InternalGitaly.WalkRepos:input_type -> gitaly.WalkReposRequest - 2, // 4: gitaly.InternalGitaly.BackupRepos:input_type -> gitaly.BackupReposRequest - 1, // 5: gitaly.InternalGitaly.WalkRepos:output_type -> gitaly.WalkReposResponse - 3, // 6: gitaly.InternalGitaly.BackupRepos:output_type -> gitaly.BackupReposResponse - 5, // [5:7] is the sub-list for method output_type - 3, // [3:5] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 2, // 0: gitaly.WalkReposResponse.modification_time:type_name -> google.protobuf.Timestamp + 0, // 1: gitaly.InternalGitaly.WalkRepos:input_type -> gitaly.WalkReposRequest + 1, // 2: gitaly.InternalGitaly.WalkRepos:output_type -> gitaly.WalkReposResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_internal_proto_init() } @@ -385,7 +197,6 @@ func file_internal_proto_init() { return } file_lint_proto_init() - file_shared_proto_init() if !protoimpl.UnsafeEnabled { file_internal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WalkReposRequest); i { @@ -411,42 +222,6 @@ func file_internal_proto_init() { return nil } } - file_internal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BackupReposRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_internal_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BackupReposResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_internal_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BackupReposRequest_Header); 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{ @@ -454,7 +229,7 @@ func file_internal_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 2, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/go/gitalypb/internal_grpc.pb.go b/proto/go/gitalypb/internal_grpc.pb.go index dd70724c3..817678ee4 100644 --- a/proto/go/gitalypb/internal_grpc.pb.go +++ b/proto/go/gitalypb/internal_grpc.pb.go @@ -25,9 +25,6 @@ type InternalGitalyClient interface { // WalkRepos walks the storage and streams back all known git repos on the // requested storage WalkRepos(ctx context.Context, in *WalkReposRequest, opts ...grpc.CallOption) (InternalGitaly_WalkReposClient, error) - // BackupRepos triggers a backup for each repository in the stream. This RPC - // is intended to be used to coordinate backups within the gitaly cluster. - BackupRepos(ctx context.Context, opts ...grpc.CallOption) (InternalGitaly_BackupReposClient, error) } type internalGitalyClient struct { @@ -70,40 +67,6 @@ func (x *internalGitalyWalkReposClient) Recv() (*WalkReposResponse, error) { return m, nil } -func (c *internalGitalyClient) BackupRepos(ctx context.Context, opts ...grpc.CallOption) (InternalGitaly_BackupReposClient, error) { - stream, err := c.cc.NewStream(ctx, &InternalGitaly_ServiceDesc.Streams[1], "/gitaly.InternalGitaly/BackupRepos", opts...) - if err != nil { - return nil, err - } - x := &internalGitalyBackupReposClient{stream} - return x, nil -} - -type InternalGitaly_BackupReposClient interface { - Send(*BackupReposRequest) error - CloseAndRecv() (*BackupReposResponse, error) - grpc.ClientStream -} - -type internalGitalyBackupReposClient struct { - grpc.ClientStream -} - -func (x *internalGitalyBackupReposClient) Send(m *BackupReposRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *internalGitalyBackupReposClient) CloseAndRecv() (*BackupReposResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(BackupReposResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - // InternalGitalyServer is the server API for InternalGitaly service. // All implementations must embed UnimplementedInternalGitalyServer // for forward compatibility @@ -111,9 +74,6 @@ type InternalGitalyServer interface { // WalkRepos walks the storage and streams back all known git repos on the // requested storage WalkRepos(*WalkReposRequest, InternalGitaly_WalkReposServer) error - // BackupRepos triggers a backup for each repository in the stream. This RPC - // is intended to be used to coordinate backups within the gitaly cluster. - BackupRepos(InternalGitaly_BackupReposServer) error mustEmbedUnimplementedInternalGitalyServer() } @@ -124,9 +84,6 @@ type UnimplementedInternalGitalyServer struct { func (UnimplementedInternalGitalyServer) WalkRepos(*WalkReposRequest, InternalGitaly_WalkReposServer) error { return status.Errorf(codes.Unimplemented, "method WalkRepos not implemented") } -func (UnimplementedInternalGitalyServer) BackupRepos(InternalGitaly_BackupReposServer) error { - return status.Errorf(codes.Unimplemented, "method BackupRepos not implemented") -} func (UnimplementedInternalGitalyServer) mustEmbedUnimplementedInternalGitalyServer() {} // UnsafeInternalGitalyServer may be embedded to opt out of forward compatibility for this service. @@ -161,32 +118,6 @@ func (x *internalGitalyWalkReposServer) Send(m *WalkReposResponse) error { return x.ServerStream.SendMsg(m) } -func _InternalGitaly_BackupRepos_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(InternalGitalyServer).BackupRepos(&internalGitalyBackupReposServer{stream}) -} - -type InternalGitaly_BackupReposServer interface { - SendAndClose(*BackupReposResponse) error - Recv() (*BackupReposRequest, error) - grpc.ServerStream -} - -type internalGitalyBackupReposServer struct { - grpc.ServerStream -} - -func (x *internalGitalyBackupReposServer) SendAndClose(m *BackupReposResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *internalGitalyBackupReposServer) Recv() (*BackupReposRequest, error) { - m := new(BackupReposRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - // InternalGitaly_ServiceDesc is the grpc.ServiceDesc for InternalGitaly service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -200,11 +131,6 @@ var InternalGitaly_ServiceDesc = grpc.ServiceDesc{ Handler: _InternalGitaly_WalkRepos_Handler, ServerStreams: true, }, - { - StreamName: "BackupRepos", - Handler: _InternalGitaly_BackupRepos_Handler, - ClientStreams: true, - }, }, Metadata: "internal.proto", } diff --git a/proto/internal.proto b/proto/internal.proto index 1e3f40882..44f18d609 100644 --- a/proto/internal.proto +++ b/proto/internal.proto @@ -4,7 +4,6 @@ package gitaly; import "google/protobuf/timestamp.proto"; import "lint.proto"; -import "shared.proto"; option go_package = "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"; @@ -19,14 +18,6 @@ service InternalGitaly { scope_level: STORAGE }; } - - // BackupRepos triggers a backup for each repository in the stream. This RPC - // is intended to be used to coordinate backups within the gitaly cluster. - rpc BackupRepos (stream BackupReposRequest) returns (BackupReposResponse) { - option (op_type) = { - op: ACCESSOR - }; - } } // This comment is left unintentionally blank. @@ -44,29 +35,3 @@ message WalkReposResponse { // modified. google.protobuf.Timestamp modification_time = 2; } - -// BackupReposRequest contains request parameters for the BackupRepos RPC. -message BackupReposRequest { - // Header contains information to create the backups and must be sent in the - // first message. - message Header { - // BackupId determines which collective backup these repository backups will - // be part of. Must be sent in first message. - string backup_id = 1; - - // StorageUrl is the object-storage URL where the backups will be stored. - // See https://gocloud.dev/howto/blob/ and https://gocloud.dev/concepts/urls/ - string storage_url = 2; - } - - // For each request stream there must be first a request with a header - // containing details about the backups to perform. - Header header = 1; - - // Repositories to have a backups triggered. - repeated Repository repositories = 2 [(target_repository)=true]; -} - -// BackupReposResponse contains response parameters for the BackupRepos RPC. -message BackupReposResponse { -} |