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:
authorJohn Cai <jcai@gitlab.com>2022-03-29 01:20:50 +0300
committerJohn Cai <jcai@gitlab.com>2022-03-29 04:13:58 +0300
commitca05cb2eaa042b660562f57f9dd5d470190231fe (patch)
tree3c10affef573dd2ce656fffeafbc6fa6eee9690a
parent7ce4caae286f4473a64d6787712925321ebc3e97 (diff)
internalgitaly: Add CleanRepos RPCjc-walk-repos-timestamp
-rw-r--r--internal/gitaly/service/internalgitaly/cleanrepos.go38
-rw-r--r--internal/gitaly/service/internalgitaly/cleanrepos_test.go51
-rw-r--r--proto/go/gitalypb/internal.pb.go170
-rw-r--r--proto/go/gitalypb/internal_grpc.pb.go43
-rw-r--r--proto/internal.proto16
-rw-r--r--ruby/proto/gitaly/internal_pb.rb8
-rw-r--r--ruby/proto/gitaly/internal_services_pb.rb3
7 files changed, 310 insertions, 19 deletions
diff --git a/internal/gitaly/service/internalgitaly/cleanrepos.go b/internal/gitaly/service/internalgitaly/cleanrepos.go
new file mode 100644
index 000000000..fac9a6f83
--- /dev/null
+++ b/internal/gitaly/service/internalgitaly/cleanrepos.go
@@ -0,0 +1,38 @@
+package internalgitaly
+
+import (
+ "context"
+ "os"
+ "path/filepath"
+ "time"
+
+ "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+)
+
+func (s *server) CleanRepos(ctx context.Context, req *gitalypb.CleanReposRequest) (*gitalypb.CleanReposResponse, error) {
+ sPath, err := s.storagePath(req.GetStorageName())
+ if err != nil {
+ return nil, err
+ }
+
+ directory := filepath.Join(
+ sPath,
+ "lost+found",
+ time.Now().Format("2006-01-02"),
+ )
+
+ if err := os.MkdirAll(directory, 0o750); err != nil {
+ return nil, err
+ }
+
+ for _, relPath := range req.GetRelativePaths() {
+ if err := os.Rename(
+ filepath.Join(sPath, relPath),
+ filepath.Join(directory, relPath),
+ ); err != nil {
+ return nil, err
+ }
+ }
+
+ return &gitalypb.CleanReposResponse{}, nil
+}
diff --git a/internal/gitaly/service/internalgitaly/cleanrepos_test.go b/internal/gitaly/service/internalgitaly/cleanrepos_test.go
new file mode 100644
index 000000000..464454798
--- /dev/null
+++ b/internal/gitaly/service/internalgitaly/cleanrepos_test.go
@@ -0,0 +1,51 @@
+package internalgitaly
+
+import (
+ "os"
+ "path/filepath"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
+ "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
+)
+
+func TestCleanRepos(t *testing.T) {
+ cfg := testcfg.Build(t)
+ storageName := cfg.Storages[0].Name
+ storageRoot := cfg.Storages[0].Path
+
+ _, deletedRepoPath := gittest.CloneRepo(t, cfg, cfg.Storages[0], gittest.CloneRepoOpts{
+ RelativePath: "a",
+ })
+
+ // 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
+ // the first repo 'a' is being streamed to the client.
+ srv := NewServer([]config.Storage{{Name: storageName, Path: storageRoot}})
+
+ client := setupInternalGitalyService(t, cfg, srv)
+ ctx := testhelper.Context(t)
+
+ _, err := client.CleanRepos(ctx, &gitalypb.CleanReposRequest{
+ StorageName: storageName,
+ RelativePaths: []string{"a"},
+ })
+ require.NoError(t, err)
+ repoNewDir := filepath.Join(storageRoot, "lost+found", time.Now().Format("2006-01-02"), "a")
+ assert.DirExists(
+ t,
+ repoNewDir,
+ "the repository should be moved to lost+found directory",
+ )
+ assert.True(t, storage.IsGitDirectory(repoNewDir))
+ _, err = os.Stat(deletedRepoPath)
+ assert.True(t, os.IsNotExist(err))
+}
diff --git a/proto/go/gitalypb/internal.pb.go b/proto/go/gitalypb/internal.pb.go
index fda7e12a8..e8440691d 100644
--- a/proto/go/gitalypb/internal.pb.go
+++ b/proto/go/gitalypb/internal.pb.go
@@ -123,6 +123,99 @@ func (x *WalkReposResponse) GetLastAccessed() *timestamppb.Timestamp {
return nil
}
+type CleanReposRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ StorageName string `protobuf:"bytes,1,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"`
+ RelativePaths []string `protobuf:"bytes,2,rep,name=relative_paths,json=relativePaths,proto3" json:"relative_paths,omitempty"`
+}
+
+func (x *CleanReposRequest) Reset() {
+ *x = CleanReposRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_internal_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CleanReposRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CleanReposRequest) ProtoMessage() {}
+
+func (x *CleanReposRequest) 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 CleanReposRequest.ProtoReflect.Descriptor instead.
+func (*CleanReposRequest) Descriptor() ([]byte, []int) {
+ return file_internal_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *CleanReposRequest) GetStorageName() string {
+ if x != nil {
+ return x.StorageName
+ }
+ return ""
+}
+
+func (x *CleanReposRequest) GetRelativePaths() []string {
+ if x != nil {
+ return x.RelativePaths
+ }
+ return nil
+}
+
+type CleanReposResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *CleanReposResponse) Reset() {
+ *x = CleanReposResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_internal_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CleanReposResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CleanReposResponse) ProtoMessage() {}
+
+func (x *CleanReposResponse) 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 CleanReposResponse.ProtoReflect.Descriptor instead.
+func (*CleanReposResponse) Descriptor() ([]byte, []int) {
+ return file_internal_proto_rawDescGZIP(), []int{3}
+}
+
var File_internal_proto protoreflect.FileDescriptor
var file_internal_proto_rawDesc = []byte{
@@ -141,17 +234,30 @@ var file_internal_proto_rawDesc = []byte{
0x6c, 0x61, 0x73, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 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,
- 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 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,
- 0x34, 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,
+ 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x63, 0x0a,
+ 0x11, 0x43, 0x6c, 0x65, 0x61, 0x6e, 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, 0x12, 0x25, 0x0a, 0x0e, 0x72,
+ 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x02, 0x20,
+ 0x03, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74,
+ 0x68, 0x73, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xad, 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, 0x4d, 0x0a, 0x0a, 0x43, 0x6c, 0x65,
+ 0x61, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x12, 0x19, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79,
+ 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x6c, 0x65, 0x61,
+ 0x6e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08,
+ 0xfa, 0x97, 0x28, 0x04, 0x08, 0x01, 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, 0x34, 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 (
@@ -166,18 +272,22 @@ func file_internal_proto_rawDescGZIP() []byte {
return file_internal_proto_rawDescData
}
-var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_internal_proto_goTypes = []interface{}{
(*WalkReposRequest)(nil), // 0: gitaly.WalkReposRequest
(*WalkReposResponse)(nil), // 1: gitaly.WalkReposResponse
- (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
+ (*CleanReposRequest)(nil), // 2: gitaly.CleanReposRequest
+ (*CleanReposResponse)(nil), // 3: gitaly.CleanReposResponse
+ (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp
}
var file_internal_proto_depIdxs = []int32{
- 2, // 0: gitaly.WalkReposResponse.last_accessed:type_name -> google.protobuf.Timestamp
+ 4, // 0: gitaly.WalkReposResponse.last_accessed: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
+ 2, // 2: gitaly.InternalGitaly.CleanRepos:input_type -> gitaly.CleanReposRequest
+ 1, // 3: gitaly.InternalGitaly.WalkRepos:output_type -> gitaly.WalkReposResponse
+ 3, // 4: gitaly.InternalGitaly.CleanRepos:output_type -> gitaly.CleanReposResponse
+ 3, // [3:5] is the sub-list for method output_type
+ 1, // [1:3] 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
@@ -214,6 +324,30 @@ func file_internal_proto_init() {
return nil
}
}
+ file_internal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CleanReposRequest); 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.(*CleanReposResponse); 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{
@@ -221,7 +355,7 @@ func file_internal_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_internal_proto_rawDesc,
NumEnums: 0,
- NumMessages: 2,
+ NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/go/gitalypb/internal_grpc.pb.go b/proto/go/gitalypb/internal_grpc.pb.go
index 6b5b3564c..ad0aa4862 100644
--- a/proto/go/gitalypb/internal_grpc.pb.go
+++ b/proto/go/gitalypb/internal_grpc.pb.go
@@ -21,6 +21,9 @@ 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)
+ // CleanRepos walks the storage and streams back all known git repos on the
+ // requested storage
+ CleanRepos(ctx context.Context, in *CleanReposRequest, opts ...grpc.CallOption) (*CleanReposResponse, error)
}
type internalGitalyClient struct {
@@ -63,6 +66,15 @@ func (x *internalGitalyWalkReposClient) Recv() (*WalkReposResponse, error) {
return m, nil
}
+func (c *internalGitalyClient) CleanRepos(ctx context.Context, in *CleanReposRequest, opts ...grpc.CallOption) (*CleanReposResponse, error) {
+ out := new(CleanReposResponse)
+ err := c.cc.Invoke(ctx, "/gitaly.InternalGitaly/CleanRepos", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// InternalGitalyServer is the server API for InternalGitaly service.
// All implementations must embed UnimplementedInternalGitalyServer
// for forward compatibility
@@ -70,6 +82,9 @@ type InternalGitalyServer interface {
// WalkRepos walks the storage and streams back all known git repos on the
// requested storage
WalkRepos(*WalkReposRequest, InternalGitaly_WalkReposServer) error
+ // CleanRepos walks the storage and streams back all known git repos on the
+ // requested storage
+ CleanRepos(context.Context, *CleanReposRequest) (*CleanReposResponse, error)
mustEmbedUnimplementedInternalGitalyServer()
}
@@ -80,6 +95,9 @@ type UnimplementedInternalGitalyServer struct {
func (UnimplementedInternalGitalyServer) WalkRepos(*WalkReposRequest, InternalGitaly_WalkReposServer) error {
return status.Errorf(codes.Unimplemented, "method WalkRepos not implemented")
}
+func (UnimplementedInternalGitalyServer) CleanRepos(context.Context, *CleanReposRequest) (*CleanReposResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CleanRepos not implemented")
+}
func (UnimplementedInternalGitalyServer) mustEmbedUnimplementedInternalGitalyServer() {}
// UnsafeInternalGitalyServer may be embedded to opt out of forward compatibility for this service.
@@ -114,13 +132,36 @@ func (x *internalGitalyWalkReposServer) Send(m *WalkReposResponse) error {
return x.ServerStream.SendMsg(m)
}
+func _InternalGitaly_CleanRepos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CleanReposRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InternalGitalyServer).CleanRepos(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/gitaly.InternalGitaly/CleanRepos",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InternalGitalyServer).CleanRepos(ctx, req.(*CleanReposRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// 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)
var InternalGitaly_ServiceDesc = grpc.ServiceDesc{
ServiceName: "gitaly.InternalGitaly",
HandlerType: (*InternalGitalyServer)(nil),
- Methods: []grpc.MethodDesc{},
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CleanRepos",
+ Handler: _InternalGitaly_CleanRepos_Handler,
+ },
+ },
Streams: []grpc.StreamDesc{
{
StreamName: "WalkRepos",
diff --git a/proto/internal.proto b/proto/internal.proto
index 714412813..d680753ba 100644
--- a/proto/internal.proto
+++ b/proto/internal.proto
@@ -18,6 +18,14 @@ service InternalGitaly {
scope_level: STORAGE
};
}
+ // CleanRepos walks the storage and streams back all known git repos on the
+ // requested storage
+ rpc CleanRepos (CleanReposRequest) returns (CleanReposResponse) {
+ option (op_type) = {
+ op: MUTATOR
+ scope_level: STORAGE
+ };
+ }
}
message WalkReposRequest {
@@ -28,3 +36,11 @@ message WalkReposResponse {
string relative_path = 1;
google.protobuf.Timestamp last_accessed = 2;
}
+
+
+message CleanReposRequest {
+ string storage_name = 1 [(storage)=true];
+ repeated string relative_paths = 2;
+}
+
+message CleanReposResponse {}
diff --git a/ruby/proto/gitaly/internal_pb.rb b/ruby/proto/gitaly/internal_pb.rb
index 749637d26..61a6bb28c 100644
--- a/ruby/proto/gitaly/internal_pb.rb
+++ b/ruby/proto/gitaly/internal_pb.rb
@@ -14,10 +14,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :relative_path, :string, 1
optional :last_accessed, :message, 2, "google.protobuf.Timestamp"
end
+ add_message "gitaly.CleanReposRequest" do
+ optional :storage_name, :string, 1
+ repeated :relative_paths, :string, 2
+ end
+ add_message "gitaly.CleanReposResponse" do
+ end
end
end
module Gitaly
WalkReposRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.WalkReposRequest").msgclass
WalkReposResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.WalkReposResponse").msgclass
+ CleanReposRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.CleanReposRequest").msgclass
+ CleanReposResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.CleanReposResponse").msgclass
end
diff --git a/ruby/proto/gitaly/internal_services_pb.rb b/ruby/proto/gitaly/internal_services_pb.rb
index 07d4b2e12..ca66ef3d2 100644
--- a/ruby/proto/gitaly/internal_services_pb.rb
+++ b/ruby/proto/gitaly/internal_services_pb.rb
@@ -19,6 +19,9 @@ module Gitaly
# WalkRepos walks the storage and streams back all known git repos on the
# requested storage
rpc :WalkRepos, ::Gitaly::WalkReposRequest, stream(::Gitaly::WalkReposResponse)
+ # CleanRepos walks the storage and streams back all known git repos on the
+ # requested storage
+ rpc :CleanRepos, ::Gitaly::CleanReposRequest, ::Gitaly::CleanReposResponse
end
Stub = Service.rpc_stub_class