diff options
24 files changed, 1638 insertions, 658 deletions
@@ -319,6 +319,8 @@ proto: ${PROTOC_GEN_GITALY} ${SOURCE_DIR}/.ruby-bundle ${SOURCE_DIR}/_support/generate-proto-ruby ${Q}# this part is related to the generation of sources from testing proto files ${PROTOC} --plugin=${PROTOC_GEN_GO} --go_out=plugins=grpc:. internal/praefect/grpc-proxy/testdata/test.proto + ${PROTOC} -I proto -I internal --plugin=${PROTOC_GEN_GO} --go_out=paths=source_relative,plugins=grpc:internal internal/middleware/cache/testdata/stream.proto + ${PROTOC} -I proto --plugin=${PROTOC_GEN_GO} --go_out=paths=source_relative,plugins=grpc:proto proto/go/internal/linter/testdata/*.proto .PHONY: proto-lint proto-lint: ${PROTOC} ${PROTOC_GEN_GO} diff --git a/internal/middleware/cache/Makefile b/internal/middleware/cache/Makefile deleted file mode 100644 index 4c9354b4c..000000000 --- a/internal/middleware/cache/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -testdata/%.pb.go: testdata/%.proto - protoc --go_out=paths=source_relative,plugins=grpc:./testdata -I${shell pwd}/../../../proto/ -I$(shell pwd)/testdata $(shell pwd)/testdata/*.proto diff --git a/internal/middleware/cache/cache.go b/internal/middleware/cache/cache.go index 5f02a89e7..d5b67373a 100644 --- a/internal/middleware/cache/cache.go +++ b/internal/middleware/cache/cache.go @@ -29,15 +29,15 @@ func methodErrLogger(method string) func(error) { } } -func shouldIgnore(fullMethod string) bool { - return strings.HasPrefix(fullMethod, "/grpc.health") +func shouldIgnore(reg *protoregistry.Registry, fullMethod string) bool { + return strings.HasPrefix(fullMethod, "/grpc.health") || reg.IsInterceptedMethod(fullMethod) } // StreamInvalidator will invalidate any mutating RPC that targets a // repository in a gRPC stream based RPC func StreamInvalidator(ci Invalidator, reg *protoregistry.Registry) grpc.StreamServerInterceptor { return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - if shouldIgnore(info.FullMethod) { + if shouldIgnore(reg, info.FullMethod) { return handler(srv, ss) } @@ -64,7 +64,7 @@ func StreamInvalidator(ci Invalidator, reg *protoregistry.Registry) grpc.StreamS // repository in a gRPC unary RPC func UnaryInvalidator(ci Invalidator, reg *protoregistry.Registry) grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { - if shouldIgnore(info.FullMethod) { + if shouldIgnore(reg, info.FullMethod) { return handler(ctx, req) } diff --git a/internal/middleware/cache/cache_test.go b/internal/middleware/cache/cache_test.go index fe0f2e39e..2ef7635ce 100644 --- a/internal/middleware/cache/cache_test.go +++ b/internal/middleware/cache/cache_test.go @@ -19,8 +19,10 @@ import ( "gitlab.com/gitlab-org/gitaly/internal/testhelper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/health" "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/status" ) //go:generate make testdata/stream.pb.go @@ -119,6 +121,10 @@ func TestInvalidators(t *testing.T) { require.NoError(t, err) require.Equal(t, 0, cache.MethodErrCount.Method["/grpc.health.v1.Health/Check"]) + _, err = testdata.NewInterceptedServiceClient(cc).IgnoredMethod(ctx, &testdata.Request{}) + require.Equal(t, status.Error(codes.Unimplemented, "method IgnoredMethod not implemented"), err) + require.Equal(t, 0, cache.MethodErrCount.Method["/testdata.InterceptedService/IgnoredMethod"]) + require.Equal(t, expectedInvalidations, mCache.(*mockCache).invalidatedRepos) require.Equal(t, expectedSvcRequests, svc.repoRequests) require.Equal(t, 3, mCache.(*mockCache).endedLeases.count) @@ -157,7 +163,7 @@ func (mc *mockCache) StartLease(repo *gitalypb.Repository) (diskcache.LeaseEnder } func streamFileDesc(t testing.TB) *descriptor.FileDescriptorProto { - fdp, err := protoregistry.ExtractFileDescriptor(proto.FileDescriptor("stream.proto")) + fdp, err := protoregistry.ExtractFileDescriptor(proto.FileDescriptor("middleware/cache/testdata/stream.proto")) require.NoError(t, err) return fdp } @@ -167,6 +173,7 @@ func newTestSvc(t testing.TB, ctx context.Context, srvr *grpc.Server, svc testda grpc_health_v1.RegisterHealthServer(srvr, healthSrvr) healthSrvr.SetServingStatus("TestService", grpc_health_v1.HealthCheckResponse_SERVING) testdata.RegisterTestServiceServer(srvr, svc) + testdata.RegisterInterceptedServiceServer(srvr, &testdata.UnimplementedInterceptedServiceServer{}) lis, err := net.Listen("tcp", ":0") require.NoError(t, err) diff --git a/internal/middleware/cache/testdata/stream.pb.go b/internal/middleware/cache/testdata/stream.pb.go index ff0d01a36..f8013cf87 100644 --- a/internal/middleware/cache/testdata/stream.pb.go +++ b/internal/middleware/cache/testdata/stream.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: stream.proto +// source: middleware/cache/testdata/stream.proto package testdata @@ -36,7 +36,7 @@ func (m *Request) Reset() { *m = Request{} } func (m *Request) String() string { return proto.CompactTextString(m) } func (*Request) ProtoMessage() {} func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_bb17ef3f514bfe54, []int{0} + return fileDescriptor_a8c7bc703e280c1d, []int{0} } func (m *Request) XXX_Unmarshal(b []byte) error { @@ -74,7 +74,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_bb17ef3f514bfe54, []int{1} + return fileDescriptor_a8c7bc703e280c1d, []int{1} } func (m *Response) XXX_Unmarshal(b []byte) error { @@ -100,28 +100,31 @@ func init() { proto.RegisterType((*Response)(nil), "testdata.Response") } -func init() { proto.RegisterFile("stream.proto", fileDescriptor_bb17ef3f514bfe54) } - -var fileDescriptor_bb17ef3f514bfe54 = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0xd1, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x80, 0x61, 0x39, 0x42, 0x25, 0x72, 0xba, 0xe0, 0x01, 0xaa, 0x4e, 0x28, 0x53, 0x07, 0xb0, - 0xab, 0xb2, 0xb1, 0xa0, 0x16, 0x21, 0x10, 0x88, 0x25, 0x85, 0x85, 0xed, 0xea, 0x9c, 0x52, 0x4b, - 0x89, 0x1d, 0xec, 0x2b, 0x28, 0x4f, 0x02, 0xaf, 0xc2, 0x0b, 0xf0, 0x50, 0x4c, 0x88, 0x86, 0xa0, - 0x8a, 0xad, 0xdd, 0xac, 0x93, 0xf5, 0xe9, 0x3f, 0x1d, 0xef, 0x07, 0xf2, 0x08, 0x95, 0xac, 0xbd, - 0x23, 0x27, 0x62, 0xc2, 0x40, 0x39, 0x10, 0x0c, 0xfb, 0x61, 0x09, 0x1e, 0xf3, 0x76, 0x9e, 0x5e, - 0xf1, 0xfd, 0x0c, 0x9f, 0x57, 0x18, 0x48, 0x9c, 0xf3, 0x24, 0xc7, 0x40, 0xc6, 0x02, 0x19, 0x67, - 0x07, 0xec, 0x98, 0x8d, 0x92, 0x89, 0x90, 0x85, 0x21, 0x28, 0x1b, 0x99, 0x61, 0xed, 0x82, 0x21, - 0xe7, 0x9b, 0xd9, 0xde, 0xfb, 0xe7, 0x09, 0xcb, 0x36, 0x3f, 0xa7, 0x9c, 0xc7, 0x19, 0x86, 0xda, - 0xd9, 0x80, 0x93, 0x8f, 0x88, 0x27, 0x0f, 0x18, 0x68, 0x8e, 0xfe, 0xc5, 0x68, 0x14, 0xb7, 0xfc, - 0xe8, 0xb2, 0x34, 0x68, 0x69, 0xbe, 0x0e, 0xfa, 0x81, 0xee, 0x57, 0x04, 0xe4, 0xbc, 0x38, 0x90, - 0x5d, 0x96, 0xfc, 0xad, 0x18, 0x8a, 0xcd, 0x51, 0x2b, 0xa6, 0xbd, 0xaf, 0xb7, 0x51, 0x14, 0xb3, - 0x31, 0x13, 0x77, 0x7c, 0xf0, 0xdf, 0x9a, 0x6a, 0x8d, 0x21, 0x6c, 0x8b, 0x45, 0x63, 0x26, 0xae, - 0xf9, 0x61, 0x8b, 0x3d, 0x5a, 0xf0, 0xcd, 0xee, 0x5d, 0xe2, 0xa6, 0xdb, 0xf0, 0x0f, 0xda, 0x31, - 0x6a, 0x36, 0x7d, 0xba, 0x28, 0x0c, 0x95, 0xb0, 0x90, 0xda, 0x55, 0xaa, 0x7d, 0x9e, 0x3a, 0x5f, - 0xa8, 0xf6, 0x0a, 0xca, 0x58, 0x42, 0x6f, 0xa1, 0x54, 0x95, 0xc9, 0xf3, 0x12, 0x5f, 0xc1, 0xa3, - 0xd2, 0xa0, 0x97, 0xa8, 0x3a, 0x73, 0xd1, 0x5b, 0x1f, 0xf6, 0xec, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0x22, 0x40, 0xfd, 0xcd, 0x00, 0x02, 0x00, 0x00, +func init() { + proto.RegisterFile("middleware/cache/testdata/stream.proto", fileDescriptor_a8c7bc703e280c1d) +} + +var fileDescriptor_a8c7bc703e280c1d = []byte{ + // 293 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0x41, 0x4a, 0xc3, 0x40, + 0x14, 0x86, 0x99, 0x52, 0x6a, 0x78, 0xd1, 0x85, 0xb3, 0xd0, 0x92, 0x95, 0x64, 0x21, 0x59, 0x48, + 0x52, 0x22, 0xb8, 0x70, 0xa7, 0x22, 0x5a, 0xa5, 0x9b, 0x54, 0x0f, 0x30, 0xce, 0x3c, 0x9a, 0x81, + 0x74, 0x26, 0xce, 0xbc, 0x2a, 0x39, 0x49, 0xbd, 0x8a, 0x17, 0xf0, 0x3c, 0xae, 0x5d, 0x89, 0x8d, + 0x91, 0xe2, 0x4a, 0xbb, 0x9c, 0x8f, 0xe1, 0xe3, 0xfb, 0x79, 0x70, 0x38, 0xd7, 0x4a, 0x55, 0xf8, + 0x2c, 0x1c, 0x66, 0x52, 0xc8, 0x12,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ee, 0x16, 0xfe, 0x88, + 0x36, 0x8c, 0x7a, 0x18, 0xac, 0x2e, 0x7d, 0xfc, 0x19, 0x00, 0x00, 0xff, 0xff, 0x34, 0xce, 0x60, + 0xcf, 0x37, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -132,6 +135,78 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 +// InterceptedServiceClient is the client API for InterceptedService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type InterceptedServiceClient interface { + IgnoredMethod(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) +} + +type interceptedServiceClient struct { + cc *grpc.ClientConn +} + +func NewInterceptedServiceClient(cc *grpc.ClientConn) InterceptedServiceClient { + return &interceptedServiceClient{cc} +} + +func (c *interceptedServiceClient) IgnoredMethod(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/testdata.InterceptedService/IgnoredMethod", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// InterceptedServiceServer is the server API for InterceptedService service. +type InterceptedServiceServer interface { + IgnoredMethod(context.Context, *Request) (*Response, error) +} + +// UnimplementedInterceptedServiceServer can be embedded to have forward compatible implementations. +type UnimplementedInterceptedServiceServer struct { +} + +func (*UnimplementedInterceptedServiceServer) IgnoredMethod(ctx context.Context, req *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method IgnoredMethod not implemented") +} + +func RegisterInterceptedServiceServer(s *grpc.Server, srv InterceptedServiceServer) { + s.RegisterService(&_InterceptedService_serviceDesc, srv) +} + +func _InterceptedService_IgnoredMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterceptedServiceServer).IgnoredMethod(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/testdata.InterceptedService/IgnoredMethod", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterceptedServiceServer).IgnoredMethod(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _InterceptedService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "testdata.InterceptedService", + HandlerType: (*InterceptedServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "IgnoredMethod", + Handler: _InterceptedService_IgnoredMethod_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "middleware/cache/testdata/stream.proto", +} + // TestServiceClient is the client API for TestService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. @@ -364,5 +439,5 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "stream.proto", + Metadata: "middleware/cache/testdata/stream.proto", } diff --git a/internal/middleware/cache/testdata/stream.proto b/internal/middleware/cache/testdata/stream.proto index 5c7d57410..e18deb3d7 100644 --- a/internal/middleware/cache/testdata/stream.proto +++ b/internal/middleware/cache/testdata/stream.proto @@ -2,16 +2,21 @@ syntax = "proto3"; package testdata; +import "lint.proto"; import "shared.proto"; -option go_package = "gitlab.com/gitlab-org/gitaly/internal/middleware/cache/testdata"; - message Request { gitaly.Repository destination = 1 [(gitaly.target_repository)=true]; } message Response{} +service InterceptedService { + option (gitaly.intercepted) = true; + + rpc IgnoredMethod(Request) returns (Response); +} + service TestService { rpc ClientStreamRepoMutator(Request) returns (stream Response) { option (gitaly.op_type) = { diff --git a/internal/praefect/middleware/methodtype.go b/internal/praefect/middleware/methodtype.go index 6143ff7ba..c8a980dc0 100644 --- a/internal/praefect/middleware/methodtype.go +++ b/internal/praefect/middleware/methodtype.go @@ -32,6 +32,10 @@ func MethodTypeStreamInterceptor(r *protoregistry.Registry) grpc.StreamServerInt } func observeMethodType(registry *protoregistry.Registry, fullMethod string) { + if registry.IsInterceptedMethod(fullMethod) { + return + } + mi, err := registry.LookupMethod(fullMethod) if err != nil { logrus.WithField("full_method_name", fullMethod).WithError(err).Warn("error when looking up method info") diff --git a/internal/praefect/protoregistry/protoregistry.go b/internal/praefect/protoregistry/protoregistry.go index 7acc94d03..62fc906f9 100644 --- a/internal/praefect/protoregistry/protoregistry.go +++ b/internal/praefect/protoregistry/protoregistry.go @@ -10,6 +10,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" + "gitlab.com/gitlab-org/gitaly/internal/protoutil" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" ) @@ -171,49 +172,44 @@ func (mi MethodInfo) UnmarshalRequestProto(b []byte) (proto.Message, error) { // Registry contains info about RPC methods type Registry struct { protos map[string]MethodInfo + // interceptedMethods contains the set of methods which are intercepted + // by Praefect instead of proxying. + interceptedMethods map[string]struct{} } // New creates a new ProtoRegistry with info from one or more descriptor.FileDescriptorProto func New(protos ...*descriptor.FileDescriptorProto) (*Registry, error) { methods := make(map[string]MethodInfo) + interceptedMethods := make(map[string]struct{}) for _, p := range protos { for _, svc := range p.GetService() { for _, method := range svc.GetMethod() { + fullMethodName := fmt.Sprintf("/%s.%s/%s", + p.GetPackage(), svc.GetName(), method.GetName(), + ) + + if intercepted, err := protoutil.IsInterceptedService(svc); err != nil { + return nil, fmt.Errorf("is intercepted: %w", err) + } else if intercepted { + interceptedMethods[fullMethodName] = struct{}{} + continue + } + mi, err := parseMethodInfo(p, method) if err != nil { return nil, err } - fullMethodName := fmt.Sprintf( - "/%s.%s/%s", - p.GetPackage(), svc.GetName(), method.GetName(), - ) methods[fullMethodName] = mi } } } - return &Registry{protos: methods}, nil -} - -func getOpExtension(m *descriptor.MethodDescriptorProto) (*gitalypb.OperationMsg, error) { - options := m.GetOptions() - - if !proto.HasExtension(options, gitalypb.E_OpType) { - return nil, fmt.Errorf("method %s missing op_type option", m.GetName()) - } - - ext, err := proto.GetExtension(options, gitalypb.E_OpType) - if err != nil { - return nil, fmt.Errorf("unable to get Gitaly custom OpType extension: %s", err) - } - - opMsg, ok := ext.(*gitalypb.OperationMsg) - if !ok { - return nil, fmt.Errorf("unable to obtain OperationMsg from %#v", ext) - } - return opMsg, nil + return &Registry{ + protos: methods, + interceptedMethods: interceptedMethods, + }, nil } type protoFactory func([]byte) (proto.Message, error) @@ -245,7 +241,7 @@ func methodReqFactory(method *descriptor.MethodDescriptorProto) (protoFactory, e } func parseMethodInfo(p *descriptor.FileDescriptorProto, methodDesc *descriptor.MethodDescriptorProto) (MethodInfo, error) { - opMsg, err := getOpExtension(methodDesc) + opMsg, err := protoutil.GetOpExtension(methodDesc) if err != nil { return MethodInfo{}, err } @@ -295,8 +291,8 @@ func parseMethodInfo(p *descriptor.FileDescriptorProto, methodDesc *descriptor.M if scope == ScopeRepository { m := matcher{ - match: getTargetRepositoryExtension, - subMatch: getRepositoryExtension, + match: protoutil.GetTargetRepositoryExtension, + subMatch: protoutil.GetRepositoryExtension, expectedType: ".gitaly.Repository", topLevelMsgs: topLevelMsgs, } @@ -310,7 +306,7 @@ func parseMethodInfo(p *descriptor.FileDescriptorProto, methodDesc *descriptor.M } mi.targetRepo = targetRepo - m.match = getAdditionalRepositoryExtension + m.match = protoutil.GetAdditionalRepositoryExtension additionalRepo, err := m.findField(topLevelMsgs[typeName]) if err != nil { return MethodInfo{}, err @@ -318,7 +314,7 @@ func parseMethodInfo(p *descriptor.FileDescriptorProto, methodDesc *descriptor.M mi.additionalRepo = additionalRepo } else if scope == ScopeStorage { m := matcher{ - match: getStorageExtension, + match: protoutil.GetStorageExtension, topLevelMsgs: topLevelMsgs, } storage, err := m.findField(topLevelMsgs[typeName]) @@ -365,46 +361,6 @@ func getTopLevelMsgs(p *descriptor.FileDescriptorProto) (map[string]*descriptor. return topLevelMsgs, nil } -func getStorageExtension(m *descriptor.FieldDescriptorProto) (bool, error) { - return getBoolExtension(m, gitalypb.E_Storage) -} - -func getTargetRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { - return getBoolExtension(m, gitalypb.E_TargetRepository) -} - -func getAdditionalRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { - return getBoolExtension(m, gitalypb.E_AdditionalRepository) -} - -func getRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { - return getBoolExtension(m, gitalypb.E_Repository) -} - -func getBoolExtension(m *descriptor.FieldDescriptorProto, extension *proto.ExtensionDesc) (bool, error) { - options := m.GetOptions() - - if !proto.HasExtension(options, extension) { - return false, nil - } - - ext, err := proto.GetExtension(options, extension) - if err != nil { - return false, err - } - - storageMsg, ok := ext.(*bool) - if !ok { - return false, fmt.Errorf("unable to obtain bool from %#v", ext) - } - - if storageMsg == nil { - return false, nil - } - - return *storageMsg, nil -} - // Matcher helps find field matching credentials. At first match method is used to check fields // recursively. Then if field matches but type don't match expectedType subMatch method is used // from this point. This matcher assumes that only one field in the message matches the credentials. @@ -495,6 +451,12 @@ func (pr *Registry) LookupMethod(fullMethodName string) (MethodInfo, error) { return methodInfo, nil } +// IsInterceptedMethod returns whether Praefect intercepts the method call instead of proxying it. +func (pr *Registry) IsInterceptedMethod(fullMethodName string) bool { + _, ok := pr.interceptedMethods[fullMethodName] + return ok +} + // ExtractFileDescriptor extracts a FileDescriptorProto from a gzip'd buffer. // https://github.com/golang/protobuf/blob/9eb2c01ac278a5d89ce4b2be68fe4500955d8179/descriptor/descriptor.go#L50 func ExtractFileDescriptor(gz []byte) (*descriptor.FileDescriptorProto, error) { diff --git a/internal/praefect/protoregistry/protoregistry_test.go b/internal/praefect/protoregistry/protoregistry_test.go index 030c971c1..df7874404 100644 --- a/internal/praefect/protoregistry/protoregistry_test.go +++ b/internal/praefect/protoregistry/protoregistry_test.go @@ -151,9 +151,6 @@ func TestNewProtoRegistry(t *testing.T) { "BackupCustomHooks": protoregistry.OpAccessor, "FetchHTTPRemote": protoregistry.OpMutator, }, - "ServerService": map[string]protoregistry.OpType{ - "ServerInfo": protoregistry.OpAccessor, - }, "SmartHTTPService": map[string]protoregistry.OpType{ "InfoRefsUploadPack": protoregistry.OpAccessor, "InfoRefsReceivePack": protoregistry.OpAccessor, @@ -179,13 +176,42 @@ func TestNewProtoRegistry(t *testing.T) { for serviceName, methods := range expectedResults { for methodName, opType := range methods { - methodInfo, err := r.LookupMethod(fmt.Sprintf("/gitaly.%s/%s", serviceName, methodName)) + method := fmt.Sprintf("/gitaly.%s/%s", serviceName, methodName) + methodInfo, err := r.LookupMethod(method) require.NoError(t, err) assert.Equalf(t, opType, methodInfo.Operation, "expect %s:%s to have the correct op type", serviceName, methodName) + require.False(t, r.IsInterceptedMethod(method), method) } } } +func TestNewProtoRegistry_IsInterceptedMethod(t *testing.T) { + for service, methods := range map[string][]string{ + "ServerService": { + "ServerInfo", + "DiskStatistics", + }, + "PraefectInfoService": { + "RepositoryReplicas", + "ConsistencyCheck", + "DatalossCheck", + "SetAuthoritativeStorage", + }, + } { + t.Run(service, func(t *testing.T) { + for _, method := range methods { + t.Run(method, func(t *testing.T) { + fullMethodName := fmt.Sprintf("/gitaly.%s/%s", service, method) + require.True(t, protoregistry.GitalyProtoPreregistered.IsInterceptedMethod(fullMethodName)) + methodInfo, err := protoregistry.GitalyProtoPreregistered.LookupMethod(fullMethodName) + require.Empty(t, methodInfo) + require.Error(t, err, "full method name not found:") + }) + } + }) + } +} + func TestRequestFactory(t *testing.T) { mInfo, err := protoregistry.GitalyProtoPreregistered.LookupMethod("/gitaly.RepositoryService/RepositoryExists") require.NoError(t, err) @@ -205,10 +231,6 @@ func TestMethodInfoScope(t *testing.T) { method: "/gitaly.RepositoryService/RepositoryExists", scope: protoregistry.ScopeRepository, }, - { - method: "/gitaly.ServerService/ServerInfo", - scope: protoregistry.ScopeServer, - }, } { t.Run(tt.method, func(t *testing.T) { mInfo, err := protoregistry.GitalyProtoPreregistered.LookupMethod(tt.method) diff --git a/internal/protoutil/extension.go b/internal/protoutil/extension.go new file mode 100644 index 000000000..34e54d504 --- /dev/null +++ b/internal/protoutil/extension.go @@ -0,0 +1,71 @@ +package protoutil + +import ( + "errors" + "fmt" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/protoc-gen-go/descriptor" + "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" +) + +// GetOpExtension gets the OperationMsg from a method descriptor +func GetOpExtension(m *descriptor.MethodDescriptorProto) (*gitalypb.OperationMsg, error) { + ext, err := getExtension(m.GetOptions(), gitalypb.E_OpType) + if err != nil { + return nil, err + } + + return ext.(*gitalypb.OperationMsg), nil +} + +// IsInterceptedService returns whether the serivce is intercepted by Praefect. +func IsInterceptedService(s *descriptor.ServiceDescriptorProto) (bool, error) { + return getBoolExtension(s.GetOptions(), gitalypb.E_Intercepted) +} + +// GetRepositoryExtension gets the repository extension from a field descriptor +func GetRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { + return getBoolExtension(m.GetOptions(), gitalypb.E_Repository) +} + +// GetStorageExtension gets the storage extension from a field descriptor +func GetStorageExtension(m *descriptor.FieldDescriptorProto) (bool, error) { + return getBoolExtension(m.GetOptions(), gitalypb.E_Storage) +} + +// GetTargetRepositoryExtension gets the target_repository extension from a field descriptor +func GetTargetRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { + return getBoolExtension(m.GetOptions(), gitalypb.E_TargetRepository) +} + +// GetAdditionaRepositoryExtension gets the target_repository extension from a field descriptor +func GetAdditionalRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { + return getBoolExtension(m.GetOptions(), gitalypb.E_AdditionalRepository) +} + +func getBoolExtension(options proto.Message, extension *proto.ExtensionDesc) (bool, error) { + val, err := getExtension(options, extension) + if err != nil { + if errors.Is(err, proto.ErrMissingExtension) { + return false, nil + } + + return false, err + } + + return *val.(*bool), nil +} + +func getExtension(options proto.Message, extension *proto.ExtensionDesc) (interface{}, error) { + if !proto.HasExtension(options, extension) { + return nil, fmt.Errorf("protoutil.getExtension %q: %w", extension.Name, proto.ErrMissingExtension) + } + + ext, err := proto.GetExtension(options, extension) + if err != nil { + return nil, fmt.Errorf("protoutil.getExtension %q: %w", extension.Name, err) + } + + return ext, nil +} diff --git a/proto/go/gitalypb/lint.pb.go b/proto/go/gitalypb/lint.pb.go index cf0b4e678..8b843cf22 100644 --- a/proto/go/gitalypb/lint.pb.go +++ b/proto/go/gitalypb/lint.pb.go @@ -128,6 +128,15 @@ func (m *OperationMsg) GetScopeLevel() OperationMsg_Scope { return OperationMsg_REPOSITORY } +var E_Intercepted = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.ServiceOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 82302, + Name: "gitaly.intercepted", + Tag: "varint,82302,opt,name=intercepted", + Filename: "lint.proto", +} + var E_OpType = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MethodOptions)(nil), ExtensionType: (*OperationMsg)(nil), @@ -177,6 +186,7 @@ func init() { proto.RegisterEnum("gitaly.OperationMsg_Operation", OperationMsg_Operation_name, OperationMsg_Operation_value) proto.RegisterEnum("gitaly.OperationMsg_Scope", OperationMsg_Scope_name, OperationMsg_Scope_value) proto.RegisterType((*OperationMsg)(nil), "gitaly.OperationMsg") + proto.RegisterExtension(E_Intercepted) proto.RegisterExtension(E_OpType) proto.RegisterExtension(E_Storage) proto.RegisterExtension(E_Repository) @@ -187,30 +197,32 @@ func init() { func init() { proto.RegisterFile("lint.proto", fileDescriptor_1612d42a10b555ca) } var fileDescriptor_1612d42a10b555ca = []byte{ - // 397 bytes of a gzipped FileDescriptorProto + // 425 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0x6b, 0xd4, 0x40, - 0x14, 0x80, 0x9b, 0x40, 0x37, 0xf5, 0xa5, 0x94, 0x38, 0x54, 0x58, 0x0a, 0x96, 0x65, 0x4f, 0xbd, - 0x38, 0x29, 0xed, 0xc9, 0x78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0xe9, 0x87, + 0xa6, 0xbe, 0x2a, 0x5b, 0x04, 0x39, 0x7d, 0x0e, 0xed, 0xf3, 0x31, 0xe9, 0x32, 0xb4, 0xa5, 0xda, + 0x4f, 0x1d, 0x96, 0xb4, 0x9e, 0xd5, 0x62, 0xd1, 0x6b, 0x57, 0xe7, 0x7f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0xb2, 0x98, 0xf0, 0x1b, 0x0b, 0x03, 0x00, 0x00, } diff --git a/proto/go/gitalypb/praefect.pb.go b/proto/go/gitalypb/praefect.pb.go index e674376e7..8c19aba37 100644 --- a/proto/go/gitalypb/praefect.pb.go +++ b/proto/go/gitalypb/praefect.pb.go @@ -617,55 +617,54 @@ func init() { func init() { proto.RegisterFile("praefect.proto", fileDescriptor_d32bf44842ead735) } var fileDescriptor_d32bf44842ead735 = []byte{ - // 765 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x95, 0x93, 0x7c, 0xad, 0x7b, 0xd3, 0x9f, 0x74, 0xbe, 0x96, 0x06, 0x53, 0xfa, 0x63, 0x04, - 0x8d, 0x44, 0x9b, 0x54, 0x29, 0x12, 0x12, 0x2b, 0x68, 0xbb, 0x29, 0xaa, 0x68, 0xe4, 0x4a, 0x2c, - 0xd8, 0x58, 0x63, 0x7b, 0x9a, 0x0c, 0x4c, 0x3c, 0x66, 0x3c, 0xa9, 0xe4, 0x27, 0x80, 0x37, 0xe0, - 0x01, 0x58, 0xb1, 0xe0, 0x35, 0x78, 0x03, 0x24, 0xc4, 0x3b, 0xf0, 0x02, 0xac, 0x90, 0xed, 0xb1, - 0x9b, 0x1f, 0xa7, 0x45, 0x65, 0x67, 0xdf, 0x7b, 0xee, 0x99, 0xb9, 0xe7, 0xdc, 0x99, 0x81, 0xc5, - 0x40, 0x60, 0x72, 0x41, 0x5c, 0xd9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 0x16, 0x51, 0xba, - 0x05, 0x2b, 0xfb, 0x45, 0xa7, 0x30, 0x2f, 0x48, 0xc0, 0x43, 0x2a, 0xb9, 0xa0, 0x24, 0xac, 0x97, - 0xb6, 0xca, 0x8d, 0x6a, 0xbb, 0xd1, 0x4c, 0x5d, 0x6c, 0x16, 0xd2, 0x35, 0xad, 0xac, 0x22, 0xb2, - 0x46, 0xaa, 0x8d, 0x1f, 0x1a, 0xc0, 0x55, 0x72, 0xd2, 0x17, 0xad, 0xc0, 0x97, 0x53, 0xd0, 0x95, - 0x3c, 0xd9, 0xea, 0xfb, 0x7f, 0xbb, 0x7a, 0x33, 0xf3, 0x22, 0x67, 0x40, 0xf7, 0x60, 0x4e, 0x10, - 0xec, 0xd9, 0xdc, 0x67, 0x51, 0xe2, 0xac, 0x6e, 0xe9, 0x71, 0xe0, 0xcc, 0x67, 0x91, 0xf1, 0x0c, - 0x66, 0x33, 0xb5, 0x11, 0x54, 0x7c, 0xdc, 0x57, 0x8e, 0x58, 0xc9, 0x77, 0x5c, 0xeb, 0x90, 0x1e, - 0xf5, 0x3d, 0xdb, 0x89, 0x12, 0xb9, 0xcb, 0x96, 0x9e, 0x06, 0x0e, 0x23, 0xf3, 0x0c, 0xee, 0x0e, - 0xb5, 0x9d, 0x8a, 0x1e, 0x66, 0x56, 0xb7, 0x01, 0x72, 0x1d, 0x52, 0x89, 0xab, 0x6d, 0x94, 0x75, - 0x31, 0x54, 0x36, 0x84, 0x32, 0x3f, 0x97, 0xc0, 0x28, 0x62, 0x54, 0x96, 0xbd, 0x1a, 0xb5, 0xac, - 0xda, 0x7e, 0x52, 0xc0, 0x37, 0x56, 0x34, 0x94, 0x3a, 0x26, 0x12, 0x53, 0x16, 0x5e, 0x19, 0xdd, - 0x01, 0x5d, 0x0d, 0x53, 0x26, 0xf3, 0xed, 0x08, 0x73, 0x16, 0xc3, 0x85, 0xe5, 0x89, 0xf4, 0x6d, - 0x94, 0x40, 0x06, 0xe8, 0x6e, 0xec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xa9, 0xff, 0xfe, - 0xd4, 0xa8, 0xe8, 0xa5, 0x9a, 0x86, 0x30, 0xd4, 0xc6, 0xd5, 0x46, 0x9b, 0x19, 0xc3, 0x94, 0xf9, - 0x32, 0xb6, 0xa6, 0x03, 0xc6, 0x16, 0x28, 0xed, 0x6b, 0xe8, 0x35, 0x2c, 0x8c, 0xdc, 0x57, 0x68, - 0x7d, 0xca, 0x35, 0x96, 0x92, 0xdf, 0xbf, 0xf6, 0x92, 0x1b, 0xda, 0xba, 0x84, 0xb5, 0x29, 0x4f, - 0x10, 0x7a, 0x94, 0x71, 0x5c, 0xff, 0x9c, 0x1a, 0x3b, 0x37, 0xe2, 0x46, 0x56, 0xd5, 0x6a, 0xa5, - 0xc3, 0xfd, 0x37, 0x71, 0x0d, 0xc3, 0x4e, 0xd3, 0xe5, 0xfd, 0x56, 0xfa, 0xb9, 0xc7, 0x45, 0xb7, - 0x95, 0x32, 0xb5, 0x92, 0xa7, 0xbc, 0xd5, 0xe5, 0xea, 0x3f, 0x70, 0x9c, 0x99, 0x24, 0x74, 0xf0, - 0x27, 0x00, 0x00, 0xff, 0xff, 0x95, 0xbb, 0xed, 0x49, 0x11, 0x08, 0x00, 0x00, + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0x96, 0x93, 0xdc, 0x36, 0x3d, 0xe9, 0xef, 0xdc, 0xf6, 0x36, 0xd7, 0x94, 0xfe, 0x18, 0x41, + 0x23, 0x41, 0x93, 0x2a, 0x45, 0x42, 0x62, 0x05, 0x6d, 0x37, 0x45, 0x15, 0x8d, 0xdc, 0x05, 0x12, + 0x2c, 0xac, 0xb1, 0x3d, 0x4d, 0xa6, 0x4c, 0x3c, 0x66, 0x3c, 0xa9, 0xe4, 0x25, 0x6b, 0x1e, 0x80, + 0x07, 0xe8, 0x03, 0xb1, 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b, 0x70, 0x12, 0x5c, 0xf0, 0x73, 0x22, 0xae, 0xa8, + 0x47, 0xd0, 0x07, 0x40, 0x93, 0x83, 0x87, 0x76, 0x6e, 0x1b, 0xca, 0xd4, 0x76, 0xd3, 0xba, 0x7b, + 0x6e, 0xd1, 0x3b, 0x58, 0x1e, 0xd7, 0x18, 0x6d, 0xe9, 0xba, 0x29, 0xf3, 0x64, 0x6e, 0x4f, 0x07, + 0x64, 0xb4, 0xfb, 0x06, 0x3a, 0x85, 0x85, 0x91, 0x5b, 0x09, 0x6d, 0x4c, 0xb9, 0xac, 0x32, 0xca, + 0x87, 0xb7, 0x5e, 0x65, 0xe8, 0x12, 0xd6, 0xa7, 0x3c, 0x2c, 0xe8, 0x89, 0xae, 0xbc, 0xfd, 0x79, + 0x34, 0x77, 0xef, 0xc4, 0x65, 0x6b, 0x99, 0x95, 0x5f, 0x5f, 0x1b, 0xc6, 0xe1, 0xfe, 0xfb, 0x04, + 0xcf, 0xb0, 0xdb, 0xf4, 0x78, 0xbf, 0x95, 0x7d, 0xee, 0x71, 0xd1, 0x6d, 0x65, 0x2c, 0xad, 0xf4, + 0x59, 0x6e, 0x75, 0xb9, 0xfa, 0x0f, 0x5d, 0x77, 0x26, 0x0d, 0x1d, 0xfc, 0x0e, 0x00, 0x00, 0xff, + 0xff, 0xaf, 0x1f, 0xf3, 0xad, 0xdd, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/go/gitalypb/server.pb.go b/proto/go/gitalypb/server.pb.go index 1c5f6ec5a..6765996a6 100644 --- a/proto/go/gitalypb/server.pb.go +++ b/proto/go/gitalypb/server.pb.go @@ -328,36 +328,36 @@ func init() { func init() { proto.RegisterFile("server.proto", fileDescriptor_ad098daeda4239f7) } var fileDescriptor_ad098daeda4239f7 = []byte{ - // 460 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53,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xe0, 0xbd, 0x7d, 0x9b, 0x62, 0x4d, 0xf1, - 0xfd, 0xab, 0x97, 0x68, 0xd4, 0xf9, 0xf5, 0x2d, 0x68, 0x75, 0x0e, 0x8e, 0x1c, 0xfc, 0x00, 0x87, - 0x97, 0xdf, 0x8f, 0xf7, 0xaf, 0xf2, 0xa5, 0x2e, 0xfb, 0xe0, 0xdf, 0xb6, 0x35, 0xa5, 0x5f, 0x3c, - 0xfb, 0xb8, 0x92, 0x16, 0x62, 0x1a, 0x26, 0x6a, 0x36, 0xae, 0x8f, 0x67, 0x4a, 0xe7, 0xe3, 0xba, - 0xc0, 0xd8, 0xfe, 0x79, 0xe3, 0x5c, 0xad, 0xe3, 0x6a, 0x3a, 0x6d, 0x5b, 0xe8, 0xf9, 0xef, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x7c, 0x52, 0xb9, 0x17, 0xb0, 0x03, 0x00, 0x00, + // 454 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x5d, 0x6e, 0xd3, 0x40, + 0x10, 0x96, 0x71, 0x08, 0xcd, 0x24, 0x29, 0x74, 0x10, 0xd4, 0x58, 0x05, 0x42, 0x10, 0x92, 0x1f, + 0xa8, 0x83, 0xca, 0x0d, 0x00, 0x21, 0xf5, 0x05, 0x24, 0x07, 0x81, 0xc4, 0x8b, 0xb5, 0xb1, 0xc7, + 0xd6, 0x0a, 0xc7, 0x6b, 0x76, 0x36, 0x41, 0x39, 0x04, 0xcf, 0x1c, 0x82, 0x03, 0x21, 0x6e, 0xc1, + 0x11, 0x50, 0x76, 0xf3, 0x57, 0x48, 0x41, 0xea, 0x8b, 0xb5, 0xf3, 0x7d, 0xdf, 0xcc, 0xce, 0x7e, + 0x33, 0x86, 0x1e, 0x93, 0x9e, 0x93, 0x8e, 0x1b, 0xad, 0x8c, 0xc2, 0x76, 0x29, 0x8d, 0xa8, 0x16, + 0x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, 0xa9, 0xa9, 0x64, 0x26, 0x8c, 0x54, 0x75, 0x5a, 0x88, + 0xcc, 0x28, 0x1d, 0xb4, 0x07, 0x5e, 0xd4, 0x4f, 0x8e, 0x76, 0x98, 0xd7, 0x96, 0x18, 0x1e, 0xc3, + 0x9d, 0x57, 0x92, 0x3f, 0x2d, 0xdf, 0x25, 0xd9, 0xc8, 0x8c, 0xd7, 0x83, 0xfa, 0xe1, 0xc1, 0xdd, + 0x3f, 0x99, 0xd5, 0xb0, 0x3e, 0xec, 0x31, 0xd9, 0xb3, 0x26, 0x3f, 0x5d, 0x9b, 0xbc, 0x3f, 0xf3, + 0x7f, 0x46, 0xe7, 0x57, 0xf0, 0xf9, 0x04, 0x3a, 0x62, 0x2e, 0x64, 0xb5, 0x31, 0xda, 0x4f, 0xb6, + 0x00, 0x22, 0xb4, 0x66, 0x4c, 0xb9, 0x35, 0xd9, 0x4f, 0xec, 0xf9, 0xec, 0xfb, 0x72, 0x9c, 0x76, + 0x09, 0x96, 0x5f, 0x99, 0x11, 0xbe, 0x04, 0xd8, 0x6e, 0x05, 0xde, 0xdb, 0xb7, 0x29, 0xd6, 0x94, + 0x30, 0xbc, 0x7c, 0x89, 0xf0, 0x2d, 0x1c, 0x5e, 0x7c, 0x35, 0xde, 0xbf, 0xcc, 0x0d, 0x57, 0xec, + 0xc1, 0xbf, 0xcd, 0x0a, 0x5b, 0xbf, 0xbe, 0x45, 0xde, 0x8b, 0x67, 0x1f, 0x97, 0xb2, 0x4a, 0x4c, + 0xe2, 0x4c, 0x4d, 0x47, 0xee, 0x78, 0xaa, 0x74, 0x39, 0x72, 0xc9, 0x23, 0xfb, 0xaf, 0x8d, 0x4a, + 0xb5, 0x8a, 0x9b, 0xc9, 0xa4, 0x6d, 0xa1, 0xe7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x49, + 0xe0, 0x72, 0xa2, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/go/internal/extension.go b/proto/go/internal/extension.go deleted file mode 100644 index 10b3cb4a3..000000000 --- a/proto/go/internal/extension.go +++ /dev/null @@ -1,70 +0,0 @@ -package internal - -import ( - "errors" - "fmt" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/protoc-gen-go/descriptor" - "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" -) - -// GetOpExtension gets the OperationMsg from a method descriptor -func GetOpExtension(m *descriptor.MethodDescriptorProto) (*gitalypb.OperationMsg, error) { - options := m.GetOptions() - - if !proto.HasExtension(options, gitalypb.E_OpType) { - return nil, errors.New("missing op_type option") - } - - ext, err := proto.GetExtension(options, gitalypb.E_OpType) - if err != nil { - return nil, err - } - - opMsg, ok := ext.(*gitalypb.OperationMsg) - if !ok { - return nil, fmt.Errorf("unable to obtain OperationMsg from %#v", ext) - } - - return opMsg, nil -} - -// GetStorageExtension gets the storage extension from a field descriptor -func GetStorageExtension(m *descriptor.FieldDescriptorProto) (bool, error) { - return getBoolExtension(m, gitalypb.E_Storage) -} - -// GetTargetRepositoryExtension gets the target_repository extension from a field descriptor -func GetTargetRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { - return getBoolExtension(m, gitalypb.E_TargetRepository) -} - -// GetRepositoryExtension gets the repository extension from a field descriptor -func GetRepositoryExtension(m *descriptor.FieldDescriptorProto) (bool, error) { - return getBoolExtension(m, gitalypb.E_Repository) -} - -func getBoolExtension(m *descriptor.FieldDescriptorProto, extension *proto.ExtensionDesc) (bool, error) { - options := m.GetOptions() - - if !proto.HasExtension(options, extension) { - return false, nil - } - - ext, err := proto.GetExtension(options, extension) - if err != nil { - return false, err - } - - storageMsg, ok := ext.(*bool) - if !ok { - return false, fmt.Errorf("unable to obtain bool from %#v", ext) - } - - if storageMsg == nil { - return false, nil - } - - return *storageMsg, nil -} diff --git a/proto/go/internal/linter/lint.go b/proto/go/internal/linter/lint.go index fe5266cb8..ca8606831 100644 --- a/proto/go/internal/linter/lint.go +++ b/proto/go/internal/linter/lint.go @@ -4,10 +4,11 @@ import ( "errors" "fmt" + "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "gitlab.com/gitlab-org/gitaly/internal/protoutil" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitaly/proto/go/internal" ) // ensureMethodOpType will ensure that method includes the op_type option. @@ -17,8 +18,12 @@ import ( // option (op_type).op = ACCESSOR; // } func ensureMethodOpType(fileDesc *descriptor.FileDescriptorProto, m *descriptor.MethodDescriptorProto, req *plugin.CodeGeneratorRequest) error { - opMsg, err := internal.GetOpExtension(m) + opMsg, err := protoutil.GetOpExtension(m) if err != nil { + if errors.Is(err, proto.ErrMissingExtension) { + return fmt.Errorf("missing op_type extension") + } + return err } @@ -46,25 +51,41 @@ func ensureMethodOpType(fileDesc *descriptor.FileDescriptorProto, m *descriptor. } } +func validateMethod(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto, method *descriptor.MethodDescriptorProto, req *plugin.CodeGeneratorRequest) error { + if intercepted, err := protoutil.IsInterceptedService(service); err != nil { + return fmt.Errorf("is intercepted service: %w", err) + } else if intercepted { + if _, err := protoutil.GetOpExtension(method); err != nil { + if errors.Is(err, proto.ErrMissingExtension) { + return nil + } + + return err + } + + return fmt.Errorf("operation type defined on an intercepted method") + } + + return ensureMethodOpType(file, method, req) +} + // LintFile ensures the file described meets Gitaly required processes. // Currently, this is limited to validating if request messages contain // a mandatory operation code. func LintFile(file *descriptor.FileDescriptorProto, req *plugin.CodeGeneratorRequest) []error { var errs []error - for _, serviceDescriptorProto := range file.GetService() { - for _, methodDescriptorProto := range serviceDescriptorProto.GetMethod() { - err := ensureMethodOpType(file, methodDescriptorProto, req) - if err != nil { - // decorate error with current file and method - err = fmt.Errorf( - "%s: Method %q: %s", - file.GetName(), methodDescriptorProto.GetName(), err, - ) - errs = append(errs, err) + for _, service := range file.GetService() { + for _, method := range service.GetMethod() { + if err := validateMethod(file, service, method, req); err != nil { + errs = append(errs, formatError(file.GetName(), service.GetName(), method.GetName(), err)) } } } return errs } + +func formatError(file, service, method string, err error) error { + return fmt.Errorf("%s: service %q: method: %q: %w", file, service, method, err) +} diff --git a/proto/go/internal/linter/lint_test.go b/proto/go/internal/linter/lint_test.go index 2f12badb0..ca530daae 100644 --- a/proto/go/internal/linter/lint_test.go +++ b/proto/go/internal/linter/lint_test.go @@ -1,4 +1,4 @@ -package linter_test +package linter import ( "errors" @@ -10,7 +10,6 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/proto/go/internal" - "gitlab.com/gitlab-org/gitaly/proto/go/internal/linter" _ "gitlab.com/gitlab-org/gitaly/proto/go/internal/linter/testdata" ) @@ -26,21 +25,22 @@ func TestLintFile(t *testing.T) { { protoPath: "go/internal/linter/testdata/invalid.proto", errs: []error{ - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod0": missing op_type option`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod1": op set to UNKNOWN`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod2": unexpected count of target_repository fields 0, expected 1, found target_repository label at: []`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod3": unexpected count of target_repository fields 1, expected 0, found target_repository label at: [InvalidMethodRequestWithRepo.destination]`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod4": unexpected count of target_repository fields 0, expected 1, found target_repository label at: []`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod5": wrong type of field RequestWithWrongTypeRepository.header.repository, expected .gitaly.Repository, got .test.InvalidMethodResponse`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod6": unexpected count of target_repository fields 0, expected 1, found target_repository label at: []`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod7": unexpected count of target_repository fields 0, expected 1, found target_repository label at: []`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod8": unexpected count of target_repository fields 0, expected 1, found target_repository label at: []`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod9": unexpected count of target_repository fields 1, expected 0, found target_repository label at: [InvalidMethodRequestWithRepo.destination]`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod10": unexpected count of storage field 1, expected 0, found storage label at: [RequestWithStorageAndRepo.storage_name]`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod11": unexpected count of storage field 1, expected 0, found storage label at: [RequestWithNestedStorageAndRepo.inner_message.storage_name]`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod12": unexpected count of storage field 1, expected 0, found storage label at: [RequestWithInnerNestedStorage.header.storage_name]`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod13": unexpected count of storage field 0, expected 1, found storage label at: []`), - errors.New(`go/internal/linter/testdata/invalid.proto: Method "InvalidMethod14": unexpected count of storage field 2, expected 1, found storage label at: [RequestWithMultipleNestedStorage.inner_message.storage_name RequestWithMultipleNestedStorage.storage_name]`), + formatError("go/internal/linter/testdata/invalid.proto", "InterceptedWithOperationType", "InvalidMethod", errors.New("operation type defined on an intercepted method")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod0", errors.New("missing op_type extension")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod1", errors.New("op set to UNKNOWN")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod2", errors.New("unexpected count of target_repository fields 0, expected 1, found target_repository label at: []")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod3", errors.New("unexpected count of target_repository fields 1, expected 0, found target_repository label at: [InvalidMethodRequestWithRepo.destination]")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod4", errors.New("unexpected count of target_repository fields 0, expected 1, found target_repository label at: []")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod5", errors.New("wrong type of field RequestWithWrongTypeRepository.header.repository, expected .gitaly.Repository, got .test.InvalidMethodResponse")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod6", errors.New("unexpected count of target_repository fields 0, expected 1, found target_repository label at: []")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod7", errors.New("unexpected count of target_repository fields 0, expected 1, found target_repository label at: []")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod8", errors.New("unexpected count of target_repository fields 0, expected 1, found target_repository label at: []")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod9", errors.New("unexpected count of target_repository fields 1, expected 0, found target_repository label at: [InvalidMethodRequestWithRepo.destination]")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod10", errors.New("unexpected count of storage field 1, expected 0, found storage label at: [RequestWithStorageAndRepo.storage_name]")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod11", errors.New("unexpected count of storage field 1, expected 0, found storage label at: [RequestWithNestedStorageAndRepo.inner_message.storage_name]")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod12", errors.New("unexpected count of storage field 1, expected 0, found storage label at: [RequestWithInnerNestedStorage.header.storage_name]")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod13", errors.New("unexpected count of storage field 0, expected 1, found storage label at: []")), + formatError("go/internal/linter/testdata/invalid.proto", "InvalidService", "InvalidMethod14", errors.New("unexpected count of storage field 2, expected 1, found storage label at: [RequestWithMultipleNestedStorage.inner_message.storage_name RequestWithMultipleNestedStorage.storage_name]")), }, }, } { @@ -65,7 +65,7 @@ func TestLintFile(t *testing.T) { req.ProtoFile = append(req.ProtoFile, fd) } - errs := linter.LintFile(fdToCheck, req) + errs := LintFile(fdToCheck, req) require.Equal(t, tt.errs, errs) }) } diff --git a/proto/go/internal/linter/method.go b/proto/go/internal/linter/method.go index 0c695e0cf..30f78e1b3 100644 --- a/proto/go/internal/linter/method.go +++ b/proto/go/internal/linter/method.go @@ -7,8 +7,8 @@ import ( "github.com/golang/protobuf/protoc-gen-go/descriptor" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" + "gitlab.com/gitlab-org/gitaly/internal/protoutil" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitaly/proto/go/internal" ) type methodLinter struct { @@ -88,7 +88,7 @@ func (ml methodLinter) ensureValidStorage(expected int) error { msgT := topLevelMsgs[reqMsgName] m := matcher{ - match: internal.GetStorageExtension, + match: protoutil.GetStorageExtension, subMatch: nil, expectedType: "", topLevelMsgs: topLevelMsgs, @@ -120,8 +120,8 @@ func (ml methodLinter) ensureValidTargetRepository(expected int) error { msgT := topLevelMsgs[reqMsgName] m := matcher{ - match: internal.GetTargetRepositoryExtension, - subMatch: internal.GetRepositoryExtension, + match: protoutil.GetTargetRepositoryExtension, + subMatch: protoutil.GetRepositoryExtension, expectedType: ".gitaly.Repository", topLevelMsgs: topLevelMsgs, } diff --git a/proto/go/internal/linter/testdata/invalid.pb.go b/proto/go/internal/linter/testdata/invalid.pb.go index 397a30b87..5a0b4a515 100644 --- a/proto/go/internal/linter/testdata/invalid.pb.go +++ b/proto/go/internal/linter/testdata/invalid.pb.go @@ -4,9 +4,13 @@ package test import ( + context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" gitalypb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" math "math" ) @@ -639,48 +643,739 @@ func init() { } var fileDescriptor_506a53e91b227711 = []byte{ - // 688 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x5d, 0x4f, 0x13, 0x4d, - 0x14, 0xc7, 0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0xbe, 0x3c, 0x86, 0xce, 0x22, 0x89, 0x77, 0xe5, 0xa4, 0xbc, 0x48, 0xe2, 0xbd, - 0x47, 0xae, 0xeb, 0x74, 0xbf, 0x9e, 0xf8, 0x2b, 0x41, 0xfc, 0x3e, 0xb9, 0xa1, 0xd5, 0x9e, 0x7a, - 0xea, 0x4d, 0x41, 0xfd, 0x01, 0x29, 0xda, 0x4c, 0x7a, 0x7a, 0xa2, 0xbb, 0xab, 0x82, 0xbb, 0xb9, - 0xe5, 0x38, 0x9a, 0xbb, 0x0f, 0xff, 0x5d, 0x37, 0x94, 0x48, 0x1b, 0x9f, 0xc9, 0x0f, 0xc4, 0x22, - 0xf9, 0xd3, 0x06, 0xd1, 0xeb, 0xe1, 0xd7, 0xa2, 0xf0, 0x52, 0xe1, 0xbb, 0xfd, 0xbd, 0x3c, 0x92, - 0xe5, 0xeb, 0x64, 0x4e, 0x63, 0x17, 0xe8, 0x0f, 0x89, 0x20, 0xbf, 0x3c, 0x62, 0x5f, 0x1c, 0x39, - 0xfd, 0x46, 0x94, 0x5c, 0x21, 0x37, 0x25, 0x62, 0xe5, 0xfe, 0xd5, 0xac, 0xf0, 0xb6, 0x12, 0xff, - 0xa1, 0x5c, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x0f, 0xf4, 0x8a, 0x91, 0x0a, 0x00, 0x00, + // 726 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x5b, 0x4f, 0xd4, 0x40, + 0x14, 0xc7, 0x9d, 0xcd, 0xba, 0x81, 0x03, 0x78, 0x99, 0xa8, 0xe0, 0x7a, 0x81, 0x14, 0x2f, 0xab, + 0x92, 0x5d, 0x28, 0xa8, 0x48, 0xf0, 0x81, 0x8d, 0x31, 0x22, 0x61, 0xd5, 0x85, 0x84, 0xc4, 0x4b, + 0x70, 0xa4, 0x27, 0xdd, 0x26, 0xa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ec, 0xef, 0xd5, 0xca, 0x03, 0xe4, 0x0c, 0xc9, 0xf0, 0xce, 0x1d, + 0x97, 0x97, 0x64, 0x78, 0xef, 0xd2, 0x6b, 0x2a, 0x5d, 0xa7, 0x26, 0xfe, 0x5a, 0x12, 0xbf, 0x47, + 0xaf, 0x2b, 0xb5, 0x85, 0x9a, 0x7a, 0x4b, 0x52, 0xbf, 0x4f, 0x8b, 0x26, 0xa2, 0x9a, 0x9e, 0xec, + 0xee, 0xbc, 0xe4, 0x6e, 0x6a, 0x28, 0x1f, 0xcd, 0xdd, 0x07, 0xff, 0xef, 0x36, 0x94, 0xe8, 0x06, + 0x9c, 0x4e, 0x37, 0xc4, 0x34, 0xfd, 0xdb, 0xe4, 0x52, 0xbb, 0xc3, 0x6f, 0x64, 0xe1, 0x99, 0xc2, + 0x73, 0xfb, 0x77, 0x79, 0x92, 0x95, 0xd7, 0xe9, 0xa4, 0xc2, 0x0c, 0x52, 0x6f, 0x12, 0x49, 0x7e, + 0xf6, 0x88, 0xf7, 0xe2, 0xc0, 0xe9, 0xb7, 0xb2, 0xe4, 0x1c, 0xbd, 0x91, 0x21, 0xce, 0x9d, 0xfb, + 0x8a, 0x15, 0xde, 0x55, 0xc2, 0x1f, 0xd9, 0xd9, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x88, + 0xa5, 0x4d, 0x15, 0x0b, 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 + +// InterceptedWithOperationTypeClient is the client API for InterceptedWithOperationType service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type InterceptedWithOperationTypeClient interface { + // intercepted services can't have operation type annotations. + InvalidMethod(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) +} + +type interceptedWithOperationTypeClient struct { + cc *grpc.ClientConn +} + +func NewInterceptedWithOperationTypeClient(cc *grpc.ClientConn) InterceptedWithOperationTypeClient { + return &interceptedWithOperationTypeClient{cc} +} + +func (c *interceptedWithOperationTypeClient) InvalidMethod(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InterceptedWithOperationType/InvalidMethod", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// InterceptedWithOperationTypeServer is the server API for InterceptedWithOperationType service. +type InterceptedWithOperationTypeServer interface { + // intercepted services can't have operation type annotations. + InvalidMethod(context.Context, *InvalidMethodRequest) (*InvalidMethodResponse, error) +} + +// UnimplementedInterceptedWithOperationTypeServer can be embedded to have forward compatible implementations. +type UnimplementedInterceptedWithOperationTypeServer struct { +} + +func (*UnimplementedInterceptedWithOperationTypeServer) InvalidMethod(ctx context.Context, req *InvalidMethodRequest) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod not implemented") +} + +func RegisterInterceptedWithOperationTypeServer(s *grpc.Server, srv InterceptedWithOperationTypeServer) { + s.RegisterService(&_InterceptedWithOperationType_serviceDesc, srv) +} + +func _InterceptedWithOperationType_InvalidMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidMethodRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterceptedWithOperationTypeServer).InvalidMethod(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InterceptedWithOperationType/InvalidMethod", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterceptedWithOperationTypeServer).InvalidMethod(ctx, req.(*InvalidMethodRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _InterceptedWithOperationType_serviceDesc = grpc.ServiceDesc{ + ServiceName: "test.InterceptedWithOperationType", + HandlerType: (*InterceptedWithOperationTypeServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "InvalidMethod", + Handler: _InterceptedWithOperationType_InvalidMethod_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "go/internal/linter/testdata/invalid.proto", +} + +// InvalidServiceClient is the client API for InvalidService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type InvalidServiceClient interface { + // should fail if op_type extension is missing + InvalidMethod0(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if op type is unknown + InvalidMethod1(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if target repo is not provided for accessor + InvalidMethod2(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if target repo is provided for server-scoped mutator + InvalidMethod3(ctx context.Context, in *InvalidMethodRequestWithRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if missing either target repo or non-repo-scope for mutator + InvalidMethod4(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if repository is not of type Repository + InvalidMethod5(ctx context.Context, in *RequestWithWrongTypeRepository, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if nested repository isn't flagged + InvalidMethod6(ctx context.Context, in *RequestWithNestedRepoNotFlagged, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if target field type is not of type Repository + InvalidMethod7(ctx context.Context, in *InvalidTargetType, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if nested target field type is not of type Repository + InvalidMethod8(ctx context.Context, in *InvalidNestedRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if target repo is specified for storage scoped RPC + InvalidMethod9(ctx context.Context, in *InvalidMethodRequestWithRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if storage is specified for implicit repository scoped RPC + InvalidMethod10(ctx context.Context, in *RequestWithStorageAndRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if storage is specified for repository scoped RPC + InvalidMethod11(ctx context.Context, in *RequestWithNestedStorageAndRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if storage is specified for server scoped RPC + InvalidMethod12(ctx context.Context, in *RequestWithInnerNestedStorage, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if storage isn't specified for storage scoped RPC + InvalidMethod13(ctx context.Context, in *InvalidTargetType, opts ...grpc.CallOption) (*InvalidMethodResponse, error) + // should fail if multiple storage is specified for storage scoped RPC + InvalidMethod14(ctx context.Context, in *RequestWithMultipleNestedStorage, opts ...grpc.CallOption) (*InvalidMethodResponse, error) +} + +type invalidServiceClient struct { + cc *grpc.ClientConn +} + +func NewInvalidServiceClient(cc *grpc.ClientConn) InvalidServiceClient { + return &invalidServiceClient{cc} +} + +func (c *invalidServiceClient) InvalidMethod0(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod0", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod1(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod1", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod2(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod2", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod3(ctx context.Context, in *InvalidMethodRequestWithRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod3", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod4(ctx context.Context, in *InvalidMethodRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod4", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod5(ctx context.Context, in *RequestWithWrongTypeRepository, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod5", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod6(ctx context.Context, in *RequestWithNestedRepoNotFlagged, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod6", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod7(ctx context.Context, in *InvalidTargetType, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod7", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod8(ctx context.Context, in *InvalidNestedRequest, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod8", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod9(ctx context.Context, in *InvalidMethodRequestWithRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod9", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod10(ctx context.Context, in *RequestWithStorageAndRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod10", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod11(ctx context.Context, in *RequestWithNestedStorageAndRepo, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod11", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod12(ctx context.Context, in *RequestWithInnerNestedStorage, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod12", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod13(ctx context.Context, in *InvalidTargetType, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod13", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *invalidServiceClient) InvalidMethod14(ctx context.Context, in *RequestWithMultipleNestedStorage, opts ...grpc.CallOption) (*InvalidMethodResponse, error) { + out := new(InvalidMethodResponse) + err := c.cc.Invoke(ctx, "/test.InvalidService/InvalidMethod14", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// InvalidServiceServer is the server API for InvalidService service. +type InvalidServiceServer interface { + // should fail if op_type extension is missing + InvalidMethod0(context.Context, *InvalidMethodRequest) (*InvalidMethodResponse, error) + // should fail if op type is unknown + InvalidMethod1(context.Context, *InvalidMethodRequest) (*InvalidMethodResponse, error) + // should fail if target repo is not provided for accessor + InvalidMethod2(context.Context, *InvalidMethodRequest) (*InvalidMethodResponse, error) + // should fail if target repo is provided for server-scoped mutator + InvalidMethod3(context.Context, *InvalidMethodRequestWithRepo) (*InvalidMethodResponse, error) + // should fail if missing either target repo or non-repo-scope for mutator + InvalidMethod4(context.Context, *InvalidMethodRequest) (*InvalidMethodResponse, error) + // should fail if repository is not of type Repository + InvalidMethod5(context.Context, *RequestWithWrongTypeRepository) (*InvalidMethodResponse, error) + // should fail if nested repository isn't flagged + InvalidMethod6(context.Context, *RequestWithNestedRepoNotFlagged) (*InvalidMethodResponse, error) + // should fail if target field type is not of type Repository + InvalidMethod7(context.Context, *InvalidTargetType) (*InvalidMethodResponse, error) + // should fail if nested target field type is not of type Repository + InvalidMethod8(context.Context, *InvalidNestedRequest) (*InvalidMethodResponse, error) + // should fail if target repo is specified for storage scoped RPC + InvalidMethod9(context.Context, *InvalidMethodRequestWithRepo) (*InvalidMethodResponse, error) + // should fail if storage is specified for implicit repository scoped RPC + InvalidMethod10(context.Context, *RequestWithStorageAndRepo) (*InvalidMethodResponse, error) + // should fail if storage is specified for repository scoped RPC + InvalidMethod11(context.Context, *RequestWithNestedStorageAndRepo) (*InvalidMethodResponse, error) + // should fail if storage is specified for server scoped RPC + InvalidMethod12(context.Context, *RequestWithInnerNestedStorage) (*InvalidMethodResponse, error) + // should fail if storage isn't specified for storage scoped RPC + InvalidMethod13(context.Context, *InvalidTargetType) (*InvalidMethodResponse, error) + // should fail if multiple storage is specified for storage scoped RPC + InvalidMethod14(context.Context, *RequestWithMultipleNestedStorage) (*InvalidMethodResponse, error) +} + +// UnimplementedInvalidServiceServer can be embedded to have forward compatible implementations. +type UnimplementedInvalidServiceServer struct { +} + +func (*UnimplementedInvalidServiceServer) InvalidMethod0(ctx context.Context, req *InvalidMethodRequest) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod0 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod1(ctx context.Context, req *InvalidMethodRequest) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod1 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod2(ctx context.Context, req *InvalidMethodRequest) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod2 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod3(ctx context.Context, req *InvalidMethodRequestWithRepo) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod3 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod4(ctx context.Context, req *InvalidMethodRequest) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod4 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod5(ctx context.Context, req *RequestWithWrongTypeRepository) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod5 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod6(ctx context.Context, req *RequestWithNestedRepoNotFlagged) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod6 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod7(ctx context.Context, req *InvalidTargetType) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod7 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod8(ctx context.Context, req *InvalidNestedRequest) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod8 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod9(ctx context.Context, req *InvalidMethodRequestWithRepo) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod9 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod10(ctx context.Context, req *RequestWithStorageAndRepo) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod10 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod11(ctx context.Context, req *RequestWithNestedStorageAndRepo) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod11 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod12(ctx context.Context, req *RequestWithInnerNestedStorage) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod12 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod13(ctx context.Context, req *InvalidTargetType) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod13 not implemented") +} +func (*UnimplementedInvalidServiceServer) InvalidMethod14(ctx context.Context, req *RequestWithMultipleNestedStorage) (*InvalidMethodResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InvalidMethod14 not implemented") +} + +func RegisterInvalidServiceServer(s *grpc.Server, srv InvalidServiceServer) { + s.RegisterService(&_InvalidService_serviceDesc, srv) +} + +func _InvalidService_InvalidMethod0_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidMethodRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod0(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod0", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod0(ctx, req.(*InvalidMethodRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod1_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidMethodRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod1(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod1", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod1(ctx, req.(*InvalidMethodRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidMethodRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod2(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod2", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod2(ctx, req.(*InvalidMethodRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod3_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidMethodRequestWithRepo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod3(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod3", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod3(ctx, req.(*InvalidMethodRequestWithRepo)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod4_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidMethodRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod4(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod4", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod4(ctx, req.(*InvalidMethodRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod5_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestWithWrongTypeRepository) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod5(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod5", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod5(ctx, req.(*RequestWithWrongTypeRepository)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod6_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestWithNestedRepoNotFlagged) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod6(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod6", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod6(ctx, req.(*RequestWithNestedRepoNotFlagged)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod7_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidTargetType) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod7(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod7", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod7(ctx, req.(*InvalidTargetType)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod8_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidNestedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod8(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod8", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod8(ctx, req.(*InvalidNestedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod9_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidMethodRequestWithRepo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod9(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod9", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod9(ctx, req.(*InvalidMethodRequestWithRepo)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod10_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestWithStorageAndRepo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod10(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod10", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod10(ctx, req.(*RequestWithStorageAndRepo)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod11_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestWithNestedStorageAndRepo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod11(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod11", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod11(ctx, req.(*RequestWithNestedStorageAndRepo)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod12_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestWithInnerNestedStorage) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod12(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod12", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod12(ctx, req.(*RequestWithInnerNestedStorage)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod13_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InvalidTargetType) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod13(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod13", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod13(ctx, req.(*InvalidTargetType)) + } + return interceptor(ctx, in, info, handler) +} + +func _InvalidService_InvalidMethod14_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestWithMultipleNestedStorage) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InvalidServiceServer).InvalidMethod14(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InvalidService/InvalidMethod14", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InvalidServiceServer).InvalidMethod14(ctx, req.(*RequestWithMultipleNestedStorage)) + } + return interceptor(ctx, in, info, handler) +} + +var _InvalidService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "test.InvalidService", + HandlerType: (*InvalidServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "InvalidMethod0", + Handler: _InvalidService_InvalidMethod0_Handler, + }, + { + MethodName: "InvalidMethod1", + Handler: _InvalidService_InvalidMethod1_Handler, + }, + { + MethodName: "InvalidMethod2", + Handler: _InvalidService_InvalidMethod2_Handler, + }, + { + MethodName: "InvalidMethod3", + Handler: _InvalidService_InvalidMethod3_Handler, + }, + { + MethodName: "InvalidMethod4", + Handler: _InvalidService_InvalidMethod4_Handler, + }, + { + MethodName: "InvalidMethod5", + Handler: _InvalidService_InvalidMethod5_Handler, + }, + { + MethodName: "InvalidMethod6", + Handler: _InvalidService_InvalidMethod6_Handler, + }, + { + MethodName: "InvalidMethod7", + Handler: _InvalidService_InvalidMethod7_Handler, + }, + { + MethodName: "InvalidMethod8", + Handler: _InvalidService_InvalidMethod8_Handler, + }, + { + MethodName: "InvalidMethod9", + Handler: _InvalidService_InvalidMethod9_Handler, + }, + { + MethodName: "InvalidMethod10", + Handler: _InvalidService_InvalidMethod10_Handler, + }, + { + MethodName: "InvalidMethod11", + Handler: _InvalidService_InvalidMethod11_Handler, + }, + { + MethodName: "InvalidMethod12", + Handler: _InvalidService_InvalidMethod12_Handler, + }, + { + MethodName: "InvalidMethod13", + Handler: _InvalidService_InvalidMethod13_Handler, + }, + { + MethodName: "InvalidMethod14", + Handler: _InvalidService_InvalidMethod14_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "go/internal/linter/testdata/invalid.proto", } diff --git a/proto/go/internal/linter/testdata/invalid.proto b/proto/go/internal/linter/testdata/invalid.proto index 4721b70ba..9647b00f3 100644 --- a/proto/go/internal/linter/testdata/invalid.proto +++ b/proto/go/internal/linter/testdata/invalid.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package test; +import "lint.proto"; import "shared.proto"; message InvalidMethodRequest {} @@ -63,6 +64,17 @@ message RequestWithNestedRepoNotFlagged { Header header = 1 [(gitaly.target_repository) = true]; } +service InterceptedWithOperationType { + option (gitaly.intercepted) = true; + + // intercepted services can't have operation type annotations. + rpc InvalidMethod(InvalidMethodRequest) returns (InvalidMethodResponse) { + option (gitaly.op_type) = { + op: ACCESSOR + }; + } +} + service InvalidService { // should fail if op_type extension is missing rpc InvalidMethod0(InvalidMethodRequest) returns (InvalidMethodResponse) {} diff --git a/proto/go/internal/linter/testdata/valid.pb.go b/proto/go/internal/linter/testdata/valid.pb.go index f9ed52c7f..2402fa89f 100644 --- a/proto/go/internal/linter/testdata/valid.pb.go +++ b/proto/go/internal/linter/testdata/valid.pb.go @@ -4,9 +4,13 @@ package test import ( + context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" gitalypb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" math "math" ) @@ -21,34 +25,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -type UserRevertResponse_CreateTreeError int32 - -const ( - UserRevertResponse_NONE UserRevertResponse_CreateTreeError = 0 - UserRevertResponse_EMPTY UserRevertResponse_CreateTreeError = 1 - UserRevertResponse_CONFLICT UserRevertResponse_CreateTreeError = 2 -) - -var UserRevertResponse_CreateTreeError_name = map[int32]string{ - 0: "NONE", - 1: "EMPTY", - 2: "CONFLICT", -} - -var UserRevertResponse_CreateTreeError_value = map[string]int32{ - "NONE": 0, - "EMPTY": 1, - "CONFLICT": 2, -} - -func (x UserRevertResponse_CreateTreeError) String() string { - return proto.EnumName(UserRevertResponse_CreateTreeError_name, int32(x)) -} - -func (UserRevertResponse_CreateTreeError) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_7058768ff0db2cf7, []int{10, 0} -} - type ValidRequest struct { Destination *gitalypb.Repository `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -462,300 +438,499 @@ func (m *ValidStorageInnerNestedRequest_Header) GetStorageName() string { return "" } -type UserRevertRequest struct { - Repository *gitalypb.Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` - User *gitalypb.User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` - Commit *gitalypb.GitCommit `protobuf:"bytes,3,opt,name=commit,proto3" json:"commit,omitempty"` - BranchName []byte `protobuf:"bytes,4,opt,name=branch_name,json=branchName,proto3" json:"branch_name,omitempty"` - Message []byte `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` - StartBranchName []byte `protobuf:"bytes,6,opt,name=start_branch_name,json=startBranchName,proto3" json:"start_branch_name,omitempty"` - StartRepository *gitalypb.Repository `protobuf:"bytes,7,opt,name=start_repository,json=startRepository,proto3" json:"start_repository,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func init() { + proto.RegisterType((*ValidRequest)(nil), "test.ValidRequest") + proto.RegisterType((*ValidRequestWithoutRepo)(nil), "test.ValidRequestWithoutRepo") + proto.RegisterType((*ValidStorageRequest)(nil), "test.ValidStorageRequest") + proto.RegisterType((*ValidResponse)(nil), "test.ValidResponse") + proto.RegisterType((*ValidNestedRequest)(nil), "test.ValidNestedRequest") + proto.RegisterType((*ValidStorageNestedRequest)(nil), "test.ValidStorageNestedRequest") + proto.RegisterType((*ValidNestedSharedRequest)(nil), "test.ValidNestedSharedRequest") + proto.RegisterType((*ValidInnerNestedRequest)(nil), "test.ValidInnerNestedRequest") + proto.RegisterType((*ValidInnerNestedRequest_Header)(nil), "test.ValidInnerNestedRequest.Header") + proto.RegisterType((*ValidStorageInnerNestedRequest)(nil), "test.ValidStorageInnerNestedRequest") + proto.RegisterType((*ValidStorageInnerNestedRequest_Header)(nil), "test.ValidStorageInnerNestedRequest.Header") } -func (m *UserRevertRequest) Reset() { *m = UserRevertRequest{} } -func (m *UserRevertRequest) String() string { return proto.CompactTextString(m) } -func (*UserRevertRequest) ProtoMessage() {} -func (*UserRevertRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7058768ff0db2cf7, []int{9} +func init() { + proto.RegisterFile("go/internal/linter/testdata/valid.proto", fileDescriptor_7058768ff0db2cf7) } -func (m *UserRevertRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserRevertRequest.Unmarshal(m, b) -} -func (m *UserRevertRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserRevertRequest.Marshal(b, m, deterministic) -} -func (m *UserRevertRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserRevertRequest.Merge(m, src) -} -func (m *UserRevertRequest) XXX_Size() int { - return xxx_messageInfo_UserRevertRequest.Size(m) -} -func (m *UserRevertRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UserRevertRequest.DiscardUnknown(m) +var fileDescriptor_7058768ff0db2cf7 = []byte{ + // 545 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xe5, 0x28, 0x44, 0x61, 0x92, 0x8a, 0x6a, 0x7b, 0x20, 0x89, 0x44, 0x41, 0x16, 0x52, + 0x23, 0x81, 0x12, 0x91, 0x52, 0x0a, 0x08, 0x72, 0x28, 0x15, 0x90, 0xa2, 0x14, 0x70, 0x2b, 0x38, + 0x70, 0x88, 0x36, 0xf1, 0xc8, 0x31, 0x72, 0xbc, 0x66, 0x77, 0x5a, 0xa9, 0x6f, 0xc0, 0x8d, 0x63, + 0x7a, 0xe1, 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d1, 0xec, 0xd2, 0xc5, 0xb4, + 0x59, 0x28, 0x17, 0x58, 0x17, 0x2a, 0xbf, 0xe5, 0x9d, 0xab, 0xea, 0xad, 0xac, 0x7e, 0xfb, 0xea, + 0xfa, 0x37, 0xa6, 0xfe, 0x21, 0xbb, 0x95, 0xd7, 0x1b, 0xcb, 0xbe, 0x1c, 0x55, 0xbe, 0x98, 0x36, + 0x8b, 0x65, 0x6b, 0xdd, 0x62, 0xfb, 0x26, 0x6c, 0x87, 0xd5, 0x8c, 0xee, 0xcc, 0xa7, 0x5d, 0x6d, + 0xe9, 0xc0, 0xa4, 0x3c, 0x62, 0x9b, 0x39, 0x4a, 0x66, 0xcf, 0x56, 0xb3, 0x7a, 0x26, 0x6b, 0x37, + 0xf3, 0x7a, 0xf9, 0x89, 0x5b, 0x8d, 0x7a, 0x65, 0xa2, 0x1e, 0xb3, 0x3f, 0xff, 0x23, 0x56, 0xa7, + 0x54, 0x60, 0x7d, 0x13, 0xf4, 0x84, 0xdd, 0xce, 0x83, 0x2e, 0xe1, 0x6a, 0x8e, 0x1b, 0x96, 0xf4, + 0xef, 0x7e, 0xfb, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x24, 0x44, 0x9b, 0x39, 0x06, 0x00, + 0x00, } -var xxx_messageInfo_UserRevertRequest proto.InternalMessageInfo +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn -func (m *UserRevertRequest) GetRepository() *gitalypb.Repository { - if m != nil { - return m.Repository - } - return nil -} +// 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 -func (m *UserRevertRequest) GetUser() *gitalypb.User { - if m != nil { - return m.User - } - return nil +// InterceptedServiceClient is the client API for InterceptedService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type InterceptedServiceClient interface { + TestMethod(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) } -func (m *UserRevertRequest) GetCommit() *gitalypb.GitCommit { - if m != nil { - return m.Commit - } - return nil +type interceptedServiceClient struct { + cc *grpc.ClientConn } -func (m *UserRevertRequest) GetBranchName() []byte { - if m != nil { - return m.BranchName - } - return nil +func NewInterceptedServiceClient(cc *grpc.ClientConn) InterceptedServiceClient { + return &interceptedServiceClient{cc} } -func (m *UserRevertRequest) GetMessage() []byte { - if m != nil { - return m.Message +func (c *interceptedServiceClient) TestMethod(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.InterceptedService/TestMethod", in, out, opts...) + if err != nil { + return nil, err } - return nil + return out, nil } -func (m *UserRevertRequest) GetStartBranchName() []byte { - if m != nil { - return m.StartBranchName - } - return nil +// InterceptedServiceServer is the server API for InterceptedService service. +type InterceptedServiceServer interface { + TestMethod(context.Context, *ValidRequest) (*ValidResponse, error) } -func (m *UserRevertRequest) GetStartRepository() *gitalypb.Repository { - if m != nil { - return m.StartRepository - } - return nil +// UnimplementedInterceptedServiceServer can be embedded to have forward compatible implementations. +type UnimplementedInterceptedServiceServer struct { } -type UserRevertResponse struct { - BranchUpdate *OperationBranchUpdate `protobuf:"bytes,1,opt,name=branch_update,json=branchUpdate,proto3" json:"branch_update,omitempty"` - CreateTreeError string `protobuf:"bytes,2,opt,name=create_tree_error,json=createTreeError,proto3" json:"create_tree_error,omitempty"` - CommitError string `protobuf:"bytes,3,opt,name=commit_error,json=commitError,proto3" json:"commit_error,omitempty"` - PreReceiveError string `protobuf:"bytes,4,opt,name=pre_receive_error,json=preReceiveError,proto3" json:"pre_receive_error,omitempty"` - CreateTreeErrorCode UserRevertResponse_CreateTreeError `protobuf:"varint,5,opt,name=create_tree_error_code,json=createTreeErrorCode,proto3,enum=test.UserRevertResponse_CreateTreeError" json:"create_tree_error_code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (*UnimplementedInterceptedServiceServer) TestMethod(ctx context.Context, req *ValidRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod not implemented") } -func (m *UserRevertResponse) Reset() { *m = UserRevertResponse{} } -func (m *UserRevertResponse) String() string { return proto.CompactTextString(m) } -func (*UserRevertResponse) ProtoMessage() {} -func (*UserRevertResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7058768ff0db2cf7, []int{10} +func RegisterInterceptedServiceServer(s *grpc.Server, srv InterceptedServiceServer) { + s.RegisterService(&_InterceptedService_serviceDesc, srv) } -func (m *UserRevertResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserRevertResponse.Unmarshal(m, b) -} -func (m *UserRevertResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserRevertResponse.Marshal(b, m, deterministic) -} -func (m *UserRevertResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserRevertResponse.Merge(m, src) +func _InterceptedService_TestMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterceptedServiceServer).TestMethod(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.InterceptedService/TestMethod", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterceptedServiceServer).TestMethod(ctx, req.(*ValidRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _InterceptedService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "test.InterceptedService", + HandlerType: (*InterceptedServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "TestMethod", + Handler: _InterceptedService_TestMethod_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "go/internal/linter/testdata/valid.proto", +} + +// ValidServiceClient is the client API for ValidService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ValidServiceClient interface { + TestMethod(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod2(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod3(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod4(ctx context.Context, in *ValidRequestWithoutRepo, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod5(ctx context.Context, in *ValidNestedRequest, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod6(ctx context.Context, in *ValidNestedSharedRequest, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod7(ctx context.Context, in *ValidInnerNestedRequest, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod8(ctx context.Context, in *ValidStorageRequest, opts ...grpc.CallOption) (*ValidResponse, error) + TestMethod9(ctx context.Context, in *ValidStorageNestedRequest, opts ...grpc.CallOption) (*ValidResponse, error) +} + +type validServiceClient struct { + cc *grpc.ClientConn +} + +func NewValidServiceClient(cc *grpc.ClientConn) ValidServiceClient { + return &validServiceClient{cc} +} + +func (c *validServiceClient) TestMethod(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *UserRevertResponse) XXX_Size() int { - return xxx_messageInfo_UserRevertResponse.Size(m) + +func (c *validServiceClient) TestMethod2(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod2", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *UserRevertResponse) XXX_DiscardUnknown() { - xxx_messageInfo_UserRevertResponse.DiscardUnknown(m) + +func (c *validServiceClient) TestMethod3(ctx context.Context, in *ValidRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod3", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -var xxx_messageInfo_UserRevertResponse proto.InternalMessageInfo +func (c *validServiceClient) TestMethod4(ctx context.Context, in *ValidRequestWithoutRepo, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod4", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} -func (m *UserRevertResponse) GetBranchUpdate() *OperationBranchUpdate { - if m != nil { - return m.BranchUpdate +func (c *validServiceClient) TestMethod5(ctx context.Context, in *ValidNestedRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod5", in, out, opts...) + if err != nil { + return nil, err } - return nil + return out, nil } -func (m *UserRevertResponse) GetCreateTreeError() string { - if m != nil { - return m.CreateTreeError +func (c *validServiceClient) TestMethod6(ctx context.Context, in *ValidNestedSharedRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod6", in, out, opts...) + if err != nil { + return nil, err } - return "" + return out, nil } -func (m *UserRevertResponse) GetCommitError() string { - if m != nil { - return m.CommitError +func (c *validServiceClient) TestMethod7(ctx context.Context, in *ValidInnerNestedRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod7", in, out, opts...) + if err != nil { + return nil, err } - return "" + return out, nil } -func (m *UserRevertResponse) GetPreReceiveError() string { - if m != nil { - return m.PreReceiveError +func (c *validServiceClient) TestMethod8(ctx context.Context, in *ValidStorageRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod8", in, out, opts...) + if err != nil { + return nil, err } - return "" + return out, nil } -func (m *UserRevertResponse) GetCreateTreeErrorCode() UserRevertResponse_CreateTreeError { - if m != nil { - return m.CreateTreeErrorCode +func (c *validServiceClient) TestMethod9(ctx context.Context, in *ValidStorageNestedRequest, opts ...grpc.CallOption) (*ValidResponse, error) { + out := new(ValidResponse) + err := c.cc.Invoke(ctx, "/test.ValidService/TestMethod9", in, out, opts...) + if err != nil { + return nil, err } - return UserRevertResponse_NONE + return out, nil } -type OperationBranchUpdate struct { - // If this string is non-empty the branch has been updated. - CommitId string `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` - // Used for cache invalidation in GitLab - RepoCreated bool `protobuf:"varint,2,opt,name=repo_created,json=repoCreated,proto3" json:"repo_created,omitempty"` - // Used for cache invalidation in GitLab - BranchCreated bool `protobuf:"varint,3,opt,name=branch_created,json=branchCreated,proto3" json:"branch_created,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +// ValidServiceServer is the server API for ValidService service. +type ValidServiceServer interface { + TestMethod(context.Context, *ValidRequest) (*ValidResponse, error) + TestMethod2(context.Context, *ValidRequest) (*ValidResponse, error) + TestMethod3(context.Context, *ValidRequest) (*ValidResponse, error) + TestMethod4(context.Context, *ValidRequestWithoutRepo) (*ValidResponse, error) + TestMethod5(context.Context, *ValidNestedRequest) (*ValidResponse, error) + TestMethod6(context.Context, *ValidNestedSharedRequest) (*ValidResponse, error) + TestMethod7(context.Context, *ValidInnerNestedRequest) (*ValidResponse, error) + TestMethod8(context.Context, *ValidStorageRequest) (*ValidResponse, error) + TestMethod9(context.Context, *ValidStorageNestedRequest) (*ValidResponse, error) } -func (m *OperationBranchUpdate) Reset() { *m = OperationBranchUpdate{} } -func (m *OperationBranchUpdate) String() string { return proto.CompactTextString(m) } -func (*OperationBranchUpdate) ProtoMessage() {} -func (*OperationBranchUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_7058768ff0db2cf7, []int{11} +// UnimplementedValidServiceServer can be embedded to have forward compatible implementations. +type UnimplementedValidServiceServer struct { } -func (m *OperationBranchUpdate) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OperationBranchUpdate.Unmarshal(m, b) +func (*UnimplementedValidServiceServer) TestMethod(ctx context.Context, req *ValidRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod not implemented") } -func (m *OperationBranchUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OperationBranchUpdate.Marshal(b, m, deterministic) +func (*UnimplementedValidServiceServer) TestMethod2(ctx context.Context, req *ValidRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod2 not implemented") } -func (m *OperationBranchUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_OperationBranchUpdate.Merge(m, src) +func (*UnimplementedValidServiceServer) TestMethod3(ctx context.Context, req *ValidRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod3 not implemented") } -func (m *OperationBranchUpdate) XXX_Size() int { - return xxx_messageInfo_OperationBranchUpdate.Size(m) +func (*UnimplementedValidServiceServer) TestMethod4(ctx context.Context, req *ValidRequestWithoutRepo) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod4 not implemented") } -func (m *OperationBranchUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_OperationBranchUpdate.DiscardUnknown(m) +func (*UnimplementedValidServiceServer) TestMethod5(ctx context.Context, req *ValidNestedRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod5 not implemented") +} +func (*UnimplementedValidServiceServer) TestMethod6(ctx context.Context, req *ValidNestedSharedRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod6 not implemented") +} +func (*UnimplementedValidServiceServer) TestMethod7(ctx context.Context, req *ValidInnerNestedRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod7 not implemented") +} +func (*UnimplementedValidServiceServer) TestMethod8(ctx context.Context, req *ValidStorageRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod8 not implemented") +} +func (*UnimplementedValidServiceServer) TestMethod9(ctx context.Context, req *ValidStorageNestedRequest) (*ValidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestMethod9 not implemented") } -var xxx_messageInfo_OperationBranchUpdate proto.InternalMessageInfo +func RegisterValidServiceServer(s *grpc.Server, srv ValidServiceServer) { + s.RegisterService(&_ValidService_serviceDesc, srv) +} -func (m *OperationBranchUpdate) GetCommitId() string { - if m != nil { - return m.CommitId +func _ValidService_TestMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidRequest) + if err := dec(in); err != nil { + return nil, err } - return "" + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod(ctx, req.(*ValidRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *OperationBranchUpdate) GetRepoCreated() bool { - if m != nil { - return m.RepoCreated +func _ValidService_TestMethod2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod2(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod2", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod2(ctx, req.(*ValidRequest)) } - return false + return interceptor(ctx, in, info, handler) } -func (m *OperationBranchUpdate) GetBranchCreated() bool { - if m != nil { - return m.BranchCreated +func _ValidService_TestMethod3_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod3(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod3", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod3(ctx, req.(*ValidRequest)) } - return false + return interceptor(ctx, in, info, handler) } -func init() { - proto.RegisterEnum("test.UserRevertResponse_CreateTreeError", UserRevertResponse_CreateTreeError_name, UserRevertResponse_CreateTreeError_value) - proto.RegisterType((*ValidRequest)(nil), "test.ValidRequest") - proto.RegisterType((*ValidRequestWithoutRepo)(nil), "test.ValidRequestWithoutRepo") - proto.RegisterType((*ValidStorageRequest)(nil), "test.ValidStorageRequest") - proto.RegisterType((*ValidResponse)(nil), "test.ValidResponse") - proto.RegisterType((*ValidNestedRequest)(nil), "test.ValidNestedRequest") - proto.RegisterType((*ValidStorageNestedRequest)(nil), "test.ValidStorageNestedRequest") - proto.RegisterType((*ValidNestedSharedRequest)(nil), "test.ValidNestedSharedRequest") - proto.RegisterType((*ValidInnerNestedRequest)(nil), "test.ValidInnerNestedRequest") - proto.RegisterType((*ValidInnerNestedRequest_Header)(nil), "test.ValidInnerNestedRequest.Header") - proto.RegisterType((*ValidStorageInnerNestedRequest)(nil), "test.ValidStorageInnerNestedRequest") - proto.RegisterType((*ValidStorageInnerNestedRequest_Header)(nil), "test.ValidStorageInnerNestedRequest.Header") - proto.RegisterType((*UserRevertRequest)(nil), "test.UserRevertRequest") - proto.RegisterType((*UserRevertResponse)(nil), "test.UserRevertResponse") - proto.RegisterType((*OperationBranchUpdate)(nil), "test.OperationBranchUpdate") +func _ValidService_TestMethod4_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidRequestWithoutRepo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod4(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod4", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod4(ctx, req.(*ValidRequestWithoutRepo)) + } + return interceptor(ctx, in, info, handler) } -func init() { - proto.RegisterFile("go/internal/linter/testdata/valid.proto", fileDescriptor_7058768ff0db2cf7) +func _ValidService_TestMethod5_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidNestedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod5(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod5", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod5(ctx, req.(*ValidNestedRequest)) + } + return interceptor(ctx, in, info, handler) } -var fileDescriptor_7058768ff0db2cf7 = []byte{ - // 887 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x18, 0x65, 0x9d, 0xad, 0xeb, 0x7c, 0xde, 0x34, 0xce, 0x44, 0x50, 0x27, 0x15, 0x6d, 0x58, 0x15, - 0xd5, 0x14, 0xe4, 0xd0, 0xb4, 0xd0, 0x82, 0x20, 0x42, 0x71, 0xd3, 0x90, 0x82, 0x9d, 0x6a, 0xe3, - 0x82, 0x10, 0x42, 0xab, 0xb1, 0xf7, 0x93, 0xbd, 0xc8, 0xde, 0x59, 0x66, 0x27, 0x96, 0x7a, 0xc3, - 0x35, 0x6f, 0xd0, 0xde, 0x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, 0x7b, - 0x40, 0x96, 0x6b, 0x1d, 0x9b, 0x5a, 0x8f, 0x73, 0xed, 0x15, 0xaf, 0xd2, 0xe5, 0x52, 0x47, 0xa6, - 0xd4, 0x13, 0x72, 0xfe, 0xe3, 0xb7, 0x3c, 0xa5, 0x12, 0x69, 0x9b, 0x42, 0x5f, 0x90, 0x3b, 0x45, - 0xa1, 0x4b, 0xb8, 0x9a, 0xc9, 0x9d, 0x82, 0x33, 0x93, 0x7b, 0xf0, 0x29, 0xb9, 0x7b, 0x99, 0x57, - 0xe3, 0x22, 0xd1, 0x23, 0x80, 0xd9, 0xb9, 0x26, 0x37, 0x8b, 0x27, 0x5d, 0xa9, 0xd4, 0xcf, 0xbb, - 0x02, 0xb2, 0xd4, 0x7a, 0x65, 0xf9, 0x2f, 0xeb, 0xe1, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x69, - 0xfe, 0x7e, 0x52, 0xa4, 0x09, 0x00, 0x00, +func _ValidService_TestMethod6_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidNestedSharedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod6(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod6", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod6(ctx, req.(*ValidNestedSharedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ValidService_TestMethod7_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidInnerNestedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod7(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod7", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod7(ctx, req.(*ValidInnerNestedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ValidService_TestMethod8_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod8(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod8", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod8(ctx, req.(*ValidStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ValidService_TestMethod9_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidStorageNestedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidServiceServer).TestMethod9(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/test.ValidService/TestMethod9", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidServiceServer).TestMethod9(ctx, req.(*ValidStorageNestedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ValidService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "test.ValidService", + HandlerType: (*ValidServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "TestMethod", + Handler: _ValidService_TestMethod_Handler, + }, + { + MethodName: "TestMethod2", + Handler: _ValidService_TestMethod2_Handler, + }, + { + MethodName: "TestMethod3", + Handler: _ValidService_TestMethod3_Handler, + }, + { + MethodName: "TestMethod4", + Handler: _ValidService_TestMethod4_Handler, + }, + { + MethodName: "TestMethod5", + Handler: _ValidService_TestMethod5_Handler, + }, + { + MethodName: "TestMethod6", + Handler: _ValidService_TestMethod6_Handler, + }, + { + MethodName: "TestMethod7", + Handler: _ValidService_TestMethod7_Handler, + }, + { + MethodName: "TestMethod8", + Handler: _ValidService_TestMethod8_Handler, + }, + { + MethodName: "TestMethod9", + Handler: _ValidService_TestMethod9_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "go/internal/linter/testdata/valid.proto", } diff --git a/proto/go/internal/linter/testdata/valid.proto b/proto/go/internal/linter/testdata/valid.proto index 7dcad082f..05ac3bcb0 100644 --- a/proto/go/internal/linter/testdata/valid.proto +++ b/proto/go/internal/linter/testdata/valid.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package test; +import "lint.proto"; import "shared.proto"; message ValidRequest { @@ -45,6 +46,14 @@ message ValidStorageInnerNestedRequest { Header header = 1; } +service InterceptedService { + // intercepted services do not need method operation and scope + // annotations. + option (gitaly.intercepted) = true; + + rpc TestMethod(ValidRequest) returns (ValidResponse); +} + service ValidService { rpc TestMethod(ValidRequest) returns (ValidResponse) { option (gitaly.op_type) = { diff --git a/proto/lint.proto b/proto/lint.proto index 09acbae58..94395a94c 100644 --- a/proto/lint.proto +++ b/proto/lint.proto @@ -28,6 +28,13 @@ message OperationMsg { Scope scope_level = 2; } +extend google.protobuf.ServiceOptions { + // intercepted indicates whether the proxy intercepts and handles the call + // instead of proxying. Intercepted services do not require scope or operation + // annotations. + bool intercepted = 82302; +} + extend google.protobuf.MethodOptions { // Random high number.. OperationMsg op_type = 82303; diff --git a/proto/praefect.proto b/proto/praefect.proto index 18db7f6f9..92994a58d 100644 --- a/proto/praefect.proto +++ b/proto/praefect.proto @@ -8,44 +8,26 @@ import "lint.proto"; import "shared.proto"; service PraefectInfoService { - rpc RepositoryReplicas(RepositoryReplicasRequest) returns (RepositoryReplicasResponse) { - option (op_type) = { - op: ACCESSOR - scope_level: SERVER - }; - } + option (intercepted) = true; + + rpc RepositoryReplicas(RepositoryReplicasRequest) returns (RepositoryReplicasResponse); // ConsistencyCheck will perform a consistency check on the requested // virtual storage backend. A stream of repository statuses will be sent // back indicating which repos are consistent with the primary and which ones // need repair. - rpc ConsistencyCheck(ConsistencyCheckRequest) returns (stream ConsistencyCheckResponse) { - option (op_type) = { - op: ACCESSOR - scope_level: STORAGE - }; - } + rpc ConsistencyCheck(ConsistencyCheckRequest) returns (stream ConsistencyCheckResponse); // DatalossCheck checks for outdated repository replicas. - rpc DatalossCheck(DatalossCheckRequest) returns (DatalossCheckResponse) { - option (op_type) = { - op: ACCESSOR - scope_level: SERVER - }; - } + rpc DatalossCheck(DatalossCheckRequest) returns (DatalossCheckResponse); // SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage. // This causes the current version of the repository on the authoritative storage to be considered the // latest and overwrite any other version on the virtual storage. - rpc SetAuthoritativeStorage(SetAuthoritativeStorageRequest) returns (SetAuthoritativeStorageResponse) { - option (op_type) = { - op: MUTATOR - scope_level: STORAGE - }; - } + rpc SetAuthoritativeStorage(SetAuthoritativeStorageRequest) returns (SetAuthoritativeStorageResponse); } message SetAuthoritativeStorageRequest { - string virtual_storage = 1 [(storage)=true]; + string virtual_storage = 1; string relative_path = 2; string authoritative_storage = 3; } @@ -53,7 +35,7 @@ message SetAuthoritativeStorageRequest { message SetAuthoritativeStorageResponse {} message DatalossCheckRequest { - string virtual_storage = 1 [(storage)=true]; + string virtual_storage = 1; // include_partially_replicated decides whether to include repositories which are fully up to date // on the primary but are outdated on some secondaries. Such repositories are still writable and do // not suffer from data loss. The data on the primary is not fully replicated which increases the @@ -100,7 +82,7 @@ message RepositoryReplicasResponse{ } message ConsistencyCheckRequest { - string virtual_storage = 1 [(storage)=true]; + string virtual_storage = 1; // The target storage is the storage you wish to check for inconsistencies // against a reference storage (typically the current primary). string target_storage = 2; diff --git a/proto/server.proto b/proto/server.proto index 29fbc55ff..5c93563cb 100644 --- a/proto/server.proto +++ b/proto/server.proto @@ -7,18 +7,10 @@ option go_package = "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"; import "lint.proto"; service ServerService { - rpc ServerInfo(ServerInfoRequest) returns (ServerInfoResponse) { - option (op_type) = { - op: ACCESSOR - scope_level: SERVER - }; - } - rpc DiskStatistics(DiskStatisticsRequest) returns (DiskStatisticsResponse) { - option (op_type) = { - op: ACCESSOR - scope_level: SERVER - }; - } + option (intercepted) = true; + + rpc ServerInfo(ServerInfoRequest) returns (ServerInfoResponse); + rpc DiskStatistics(DiskStatisticsRequest) returns (DiskStatisticsResponse); } message ServerInfoRequest {} |