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>2019-10-25 01:38:13 +0300
committerJohn Cai <jcai@gitlab.com>2019-10-25 01:38:13 +0300
commit40b5cfecc626c1db8cecb9610d75eeb7878503b7 (patch)
tree6b9a5e7e607604ebc1fcfb6195185e631d729ed9
parent3b700822524aded160cc7a20573d1fac1ea62ca2 (diff)
Add a ReplicaService for praefectjc-add-praefect-replicas-service
-rw-r--r--proto/go/gitalypb/praefect.pb.go270
-rw-r--r--proto/go/gitalypb/protolist.go1
-rw-r--r--proto/praefect.proto30
-rw-r--r--ruby/proto/gitaly.rb2
-rw-r--r--ruby/proto/gitaly/praefect_pb.rb25
-rw-r--r--ruby/proto/gitaly/praefect_services_pb.rb22
6 files changed, 350 insertions, 0 deletions
diff --git a/proto/go/gitalypb/praefect.pb.go b/proto/go/gitalypb/praefect.pb.go
new file mode 100644
index 000000000..38f1bd11f
--- /dev/null
+++ b/proto/go/gitalypb/praefect.pb.go
@@ -0,0 +1,270 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: praefect.proto
+
+package gitalypb
+
+import (
+ context "context"
+ fmt "fmt"
+ proto "github.com/golang/protobuf/proto"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+ math "math"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+type RepositoryReplicasRequest struct {
+ Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *RepositoryReplicasRequest) Reset() { *m = RepositoryReplicasRequest{} }
+func (m *RepositoryReplicasRequest) String() string { return proto.CompactTextString(m) }
+func (*RepositoryReplicasRequest) ProtoMessage() {}
+func (*RepositoryReplicasRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_d32bf44842ead735, []int{0}
+}
+
+func (m *RepositoryReplicasRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_RepositoryReplicasRequest.Unmarshal(m, b)
+}
+func (m *RepositoryReplicasRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_RepositoryReplicasRequest.Marshal(b, m, deterministic)
+}
+func (m *RepositoryReplicasRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_RepositoryReplicasRequest.Merge(m, src)
+}
+func (m *RepositoryReplicasRequest) XXX_Size() int {
+ return xxx_messageInfo_RepositoryReplicasRequest.Size(m)
+}
+func (m *RepositoryReplicasRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_RepositoryReplicasRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_RepositoryReplicasRequest proto.InternalMessageInfo
+
+func (m *RepositoryReplicasRequest) GetRepository() *Repository {
+ if m != nil {
+ return m.Repository
+ }
+ return nil
+}
+
+type RepositoryReplicasResponse struct {
+ Primary *RepositoryReplicasResponse_ReplicaInfo `protobuf:"bytes,1,opt,name=primary,proto3" json:"primary,omitempty"`
+ Secondaries []*RepositoryReplicasResponse_ReplicaInfo `protobuf:"bytes,2,rep,name=secondaries,proto3" json:"secondaries,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *RepositoryReplicasResponse) Reset() { *m = RepositoryReplicasResponse{} }
+func (m *RepositoryReplicasResponse) String() string { return proto.CompactTextString(m) }
+func (*RepositoryReplicasResponse) ProtoMessage() {}
+func (*RepositoryReplicasResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_d32bf44842ead735, []int{1}
+}
+
+func (m *RepositoryReplicasResponse) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_RepositoryReplicasResponse.Unmarshal(m, b)
+}
+func (m *RepositoryReplicasResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_RepositoryReplicasResponse.Marshal(b, m, deterministic)
+}
+func (m *RepositoryReplicasResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_RepositoryReplicasResponse.Merge(m, src)
+}
+func (m *RepositoryReplicasResponse) XXX_Size() int {
+ return xxx_messageInfo_RepositoryReplicasResponse.Size(m)
+}
+func (m *RepositoryReplicasResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_RepositoryReplicasResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_RepositoryReplicasResponse proto.InternalMessageInfo
+
+func (m *RepositoryReplicasResponse) GetPrimary() *RepositoryReplicasResponse_ReplicaInfo {
+ if m != nil {
+ return m.Primary
+ }
+ return nil
+}
+
+func (m *RepositoryReplicasResponse) GetSecondaries() []*RepositoryReplicasResponse_ReplicaInfo {
+ if m != nil {
+ return m.Secondaries
+ }
+ return nil
+}
+
+type RepositoryReplicasResponse_ReplicaInfo struct {
+ Storage string `protobuf:"bytes,1,opt,name=storage,proto3" json:"storage,omitempty"`
+ Checksum string `protobuf:"bytes,2,opt,name=checksum,proto3" json:"checksum,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *RepositoryReplicasResponse_ReplicaInfo) Reset() {
+ *m = RepositoryReplicasResponse_ReplicaInfo{}
+}
+func (m *RepositoryReplicasResponse_ReplicaInfo) String() string { return proto.CompactTextString(m) }
+func (*RepositoryReplicasResponse_ReplicaInfo) ProtoMessage() {}
+func (*RepositoryReplicasResponse_ReplicaInfo) Descriptor() ([]byte, []int) {
+ return fileDescriptor_d32bf44842ead735, []int{1, 0}
+}
+
+func (m *RepositoryReplicasResponse_ReplicaInfo) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_RepositoryReplicasResponse_ReplicaInfo.Unmarshal(m, b)
+}
+func (m *RepositoryReplicasResponse_ReplicaInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_RepositoryReplicasResponse_ReplicaInfo.Marshal(b, m, deterministic)
+}
+func (m *RepositoryReplicasResponse_ReplicaInfo) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_RepositoryReplicasResponse_ReplicaInfo.Merge(m, src)
+}
+func (m *RepositoryReplicasResponse_ReplicaInfo) XXX_Size() int {
+ return xxx_messageInfo_RepositoryReplicasResponse_ReplicaInfo.Size(m)
+}
+func (m *RepositoryReplicasResponse_ReplicaInfo) XXX_DiscardUnknown() {
+ xxx_messageInfo_RepositoryReplicasResponse_ReplicaInfo.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_RepositoryReplicasResponse_ReplicaInfo proto.InternalMessageInfo
+
+func (m *RepositoryReplicasResponse_ReplicaInfo) GetStorage() string {
+ if m != nil {
+ return m.Storage
+ }
+ return ""
+}
+
+func (m *RepositoryReplicasResponse_ReplicaInfo) GetChecksum() string {
+ if m != nil {
+ return m.Checksum
+ }
+ return ""
+}
+
+func init() {
+ proto.RegisterType((*RepositoryReplicasRequest)(nil), "gitaly.RepositoryReplicasRequest")
+ proto.RegisterType((*RepositoryReplicasResponse)(nil), "gitaly.RepositoryReplicasResponse")
+ proto.RegisterType((*RepositoryReplicasResponse_ReplicaInfo)(nil), "gitaly.RepositoryReplicasResponse.ReplicaInfo")
+}
+
+func init() { proto.RegisterFile("praefect.proto", fileDescriptor_d32bf44842ead735) }
+
+var fileDescriptor_d32bf44842ead735 = []byte{
+ // 280 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b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a, 0x32, 0xa2, 0xc4, 0xb6, 0xea, 0x51, 0xbe, 0x1b, 0x59,
+ 0x0c, 0x81, 0x5c, 0xa3, 0x7c, 0xb2, 0x9b, 0x3a, 0xf2, 0x5b, 0x6b, 0x98, 0xb3, 0x57, 0x98, 0xf5,
+ 0x90, 0x07, 0x34, 0x2f, 0x4a, 0x22, 0x43, 0x60, 0x3f, 0xdb, 0xb0, 0xb3, 0xdf, 0x9a, 0xb6, 0xcf,
+ 0x1f, 0x27, 0x7f, 0x5f, 0x26, 0x09, 0xde, 0xdf, 0x16, 0x87, 0x81, 0x7f, 0xe2, 0x5d, 0x5d, 0x3c,
+ 0x7e, 0xad, 0x57, 0xa2, 0xe0, 0x92, 0xea, 0xb4, 0x3b, 0x9e, 0x93, 0x29, 0xd3, 0x0e, 0x92, 0xb6,
+ 0xff, 0x9d, 0x96, 0xd4, 0xcf, 0xba, 0x28, 0x26, 0xad, 0x74, 0xf9, 0x19, 0x00, 0x00, 0xff, 0xff,
+ 0xd9, 0x78, 0xb0, 0x26, 0x2a, 0x02, 0x00, 0x00,
+}
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ context.Context
+var _ grpc.ClientConn
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+const _ = grpc.SupportPackageIsVersion4
+
+// ReplicaServiceClient is the client API for ReplicaService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
+type ReplicaServiceClient interface {
+ RepositoryReplicas(ctx context.Context, in *RepositoryReplicasRequest, opts ...grpc.CallOption) (*RepositoryReplicasResponse, error)
+}
+
+type replicaServiceClient struct {
+ cc *grpc.ClientConn
+}
+
+func NewReplicaServiceClient(cc *grpc.ClientConn) ReplicaServiceClient {
+ return &replicaServiceClient{cc}
+}
+
+func (c *replicaServiceClient) RepositoryReplicas(ctx context.Context, in *RepositoryReplicasRequest, opts ...grpc.CallOption) (*RepositoryReplicasResponse, error) {
+ out := new(RepositoryReplicasResponse)
+ err := c.cc.Invoke(ctx, "/gitaly.ReplicaService/RepositoryReplicas", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// ReplicaServiceServer is the server API for ReplicaService service.
+type ReplicaServiceServer interface {
+ RepositoryReplicas(context.Context, *RepositoryReplicasRequest) (*RepositoryReplicasResponse, error)
+}
+
+// UnimplementedReplicaServiceServer can be embedded to have forward compatible implementations.
+type UnimplementedReplicaServiceServer struct {
+}
+
+func (*UnimplementedReplicaServiceServer) RepositoryReplicas(ctx context.Context, req *RepositoryReplicasRequest) (*RepositoryReplicasResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method RepositoryReplicas not implemented")
+}
+
+func RegisterReplicaServiceServer(s *grpc.Server, srv ReplicaServiceServer) {
+ s.RegisterService(&_ReplicaService_serviceDesc, srv)
+}
+
+func _ReplicaService_RepositoryReplicas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(RepositoryReplicasRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ReplicaServiceServer).RepositoryReplicas(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/gitaly.ReplicaService/RepositoryReplicas",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ReplicaServiceServer).RepositoryReplicas(ctx, req.(*RepositoryReplicasRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+var _ReplicaService_serviceDesc = grpc.ServiceDesc{
+ ServiceName: "gitaly.ReplicaService",
+ HandlerType: (*ReplicaServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "RepositoryReplicas",
+ Handler: _ReplicaService_RepositoryReplicas_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "praefect.proto",
+}
diff --git a/proto/go/gitalypb/protolist.go b/proto/go/gitalypb/protolist.go
index 04c052512..236ac7b92 100644
--- a/proto/go/gitalypb/protolist.go
+++ b/proto/go/gitalypb/protolist.go
@@ -13,6 +13,7 @@ var GitalyProtos = []string{
"namespace.proto",
"objectpool.proto",
"operations.proto",
+ "praefect.proto",
"ref.proto",
"remote.proto",
"repository-service.proto",
diff --git a/proto/praefect.proto b/proto/praefect.proto
new file mode 100644
index 000000000..ec050ef57
--- /dev/null
+++ b/proto/praefect.proto
@@ -0,0 +1,30 @@
+syntax = "proto3";
+
+package gitaly;
+
+option go_package = "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb";
+
+import "shared.proto";
+
+service ReplicaService {
+ rpc RepositoryReplicas(RepositoryReplicasRequest) returns (RepositoryReplicasResponse) {
+ option (op_type) = {
+ op: ACCESSOR
+ scope_level: SERVER,
+ };
+ }
+}
+
+message RepositoryReplicasRequest {
+ Repository repository = 1;
+}
+
+message RepositoryReplicasResponse {
+ message ReplicaInfo{
+ string storage = 1;
+ string checksum = 2;
+ }
+
+ ReplicaInfo primary = 1;
+ repeated ReplicaInfo secondaries = 2;
+}
diff --git a/ruby/proto/gitaly.rb b/ruby/proto/gitaly.rb
index dc8df4e1c..e130336b0 100644
--- a/ruby/proto/gitaly.rb
+++ b/ruby/proto/gitaly.rb
@@ -21,6 +21,8 @@ require 'gitaly/objectpool_services_pb'
require 'gitaly/operations_services_pb'
+require 'gitaly/praefect_services_pb'
+
require 'gitaly/ref_services_pb'
require 'gitaly/remote_services_pb'
diff --git a/ruby/proto/gitaly/praefect_pb.rb b/ruby/proto/gitaly/praefect_pb.rb
new file mode 100644
index 000000000..3072da1e8
--- /dev/null
+++ b/ruby/proto/gitaly/praefect_pb.rb
@@ -0,0 +1,25 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: praefect.proto
+
+require 'google/protobuf'
+
+require 'shared_pb'
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "gitaly.RepositoryReplicasRequest" do
+ optional :repository, :message, 1, "gitaly.Repository"
+ end
+ add_message "gitaly.RepositoryReplicasResponse" do
+ optional :primary, :message, 1, "gitaly.RepositoryReplicasResponse.ReplicaInfo"
+ repeated :secondaries, :message, 2, "gitaly.RepositoryReplicasResponse.ReplicaInfo"
+ end
+ add_message "gitaly.RepositoryReplicasResponse.ReplicaInfo" do
+ optional :storage, :string, 1
+ optional :checksum, :string, 2
+ end
+end
+
+module Gitaly
+ RepositoryReplicasRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RepositoryReplicasRequest").msgclass
+ RepositoryReplicasResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RepositoryReplicasResponse").msgclass
+ RepositoryReplicasResponse::ReplicaInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RepositoryReplicasResponse.ReplicaInfo").msgclass
+end
diff --git a/ruby/proto/gitaly/praefect_services_pb.rb b/ruby/proto/gitaly/praefect_services_pb.rb
new file mode 100644
index 000000000..61c8a6ef2
--- /dev/null
+++ b/ruby/proto/gitaly/praefect_services_pb.rb
@@ -0,0 +1,22 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# Source: praefect.proto for package 'gitaly'
+
+require 'grpc'
+require 'praefect_pb'
+
+module Gitaly
+ module ReplicaService
+ class Service
+
+ include GRPC::GenericService
+
+ self.marshal_class_method = :encode
+ self.unmarshal_class_method = :decode
+ self.service_name = 'gitaly.ReplicaService'
+
+ rpc :RepositoryReplicas, RepositoryReplicasRequest, RepositoryReplicasResponse
+ end
+
+ Stub = Service.rpc_stub_class
+ end
+end