diff options
author | John Cai <jcai@gitlab.com> | 2019-08-21 00:30:54 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-08-21 00:49:55 +0300 |
commit | 5d97323a26216e2450521bb5e576f4320210df31 (patch) | |
tree | 13693f00e9a7fa55cd4529862810f7e4c1bddf1a | |
parent | 66ab3b2a60e9cd1802e8ae4664934f551d0ff750 (diff) |
Parse target storage for storage scoped messagesjc-parse-target-storage
-rw-r--r-- | internal/praefect/protoregistry/protoregistry.go | 26 | ||||
-rw-r--r-- | internal/praefect/protoregistry/targetrepo.go | 45 | ||||
-rw-r--r-- | proto/go/gitalypb/namespace.pb.go | 46 | ||||
-rw-r--r-- | proto/go/gitalypb/shared.pb.go | 125 | ||||
-rw-r--r-- | proto/namespace.proto | 12 | ||||
-rw-r--r-- | proto/shared.proto | 7 | ||||
-rw-r--r-- | ruby/proto/gitaly/shared_pb.rb | 1 |
7 files changed, 159 insertions, 103 deletions
diff --git a/internal/praefect/protoregistry/protoregistry.go b/internal/praefect/protoregistry/protoregistry.go index 21c5254ff..f0e29a5cd 100644 --- a/internal/praefect/protoregistry/protoregistry.go +++ b/internal/praefect/protoregistry/protoregistry.go @@ -81,7 +81,7 @@ var protoScope = map[gitalypb.OperationMsg_Scope]Scope{ type MethodInfo struct { Operation OpType Scope Scope - targetRepo []int + targetField []int requestName string // protobuf message name for input type requestFactory protoFactory } @@ -95,7 +95,16 @@ func (mi MethodInfo) TargetRepo(msg proto.Message) (*gitalypb.Repository, error) ) } - return reflectFindRepoTarget(msg, mi.targetRepo) + return reflectFindRepoTarget(msg, mi.targetField) +} + +// TargetStorage returns the target storage for a protobuf message if it exists +func (mi MethodInfo) TargetStorage(msg proto.Message) (string, error) { + if mi.Scope != ScopeStorage { + return "", fmt.Errorf("proto message %s is not storage scoped", proto.MessageName(msg)) + } + + return reflectFindStringTarget(msg, mi.targetField) } // UnmarshalRequestProto will unmarshal the bytes into the method's request @@ -229,12 +238,19 @@ func parseMethodInfo(methodDesc *descriptor.MethodDescriptorProto) (MethodInfo, requestFactory: reqFactory, } - if scope == ScopeRepository { - targetRepo, err := parseOID(opMsg.GetTargetRepositoryField()) + switch scope { + case ScopeRepository: + targetField, err := parseOID(opMsg.GetTargetRepositoryField()) + if err != nil { + return MethodInfo{}, err + } + mi.targetField = targetField + case ScopeStorage: + targetField, err := parseOID(opMsg.GetTargetStorageField()) if err != nil { return MethodInfo{}, err } - mi.targetRepo = targetRepo + mi.targetField = targetField } return mi, nil diff --git a/internal/praefect/protoregistry/targetrepo.go b/internal/praefect/protoregistry/targetrepo.go index 16afe395c..fa2a5aab0 100644 --- a/internal/praefect/protoregistry/targetrepo.go +++ b/internal/praefect/protoregistry/targetrepo.go @@ -21,6 +21,39 @@ const ( func reflectFindRepoTarget(pbMsg proto.Message, targetOID []int) (*gitalypb.Repository, error) { var targetRepo *gitalypb.Repository + msgV, err := traverseProtoMessage(pbMsg, targetOID) + if err != nil { + return nil, err + } + + targetRepo, ok := msgV.Interface().(*gitalypb.Repository) + if !ok { + return nil, fmt.Errorf("repo target OID %v points to non-Repo type %+v", targetOID, msgV.Interface()) + } + + return targetRepo, nil +} + +// reflectFindStringTarget finds the target string field by using the OID to +// navigate the struct tags +func reflectFindStringTarget(pbMsg proto.Message, targetOID []int) (string, error) { + var targetStorage string + + msgV, err := traverseProtoMessage(pbMsg, targetOID) + if err != nil { + return "", err + } + + targetStorage, ok := msgV.Interface().(string) + if !ok { + return "", fmt.Errorf("storage target OID 1 points to non-storage type %+v", msgV.Interface()) + } + + return targetStorage, nil +} + +func traverseProtoMessage(pbMsg proto.Message, targetOID []int) (reflect.Value, error) { + msgV := reflect.ValueOf(pbMsg) for _, fieldNo := range targetOID { @@ -28,19 +61,11 @@ func reflectFindRepoTarget(pbMsg proto.Message, targetOID []int) (*gitalypb.Repo msgV, err = findProtoField(msgV, fieldNo) if err != nil { - return nil, fmt.Errorf( - "unable to descend OID %+v into message %s: %s", - targetOID, proto.MessageName(pbMsg), err, - ) + return reflect.Value{}, err } } - targetRepo, ok := msgV.Interface().(*gitalypb.Repository) - if !ok { - return nil, fmt.Errorf("repo target OID %v points to non-Repo type %+v", targetOID, msgV.Interface()) - } - - return targetRepo, nil + return msgV, nil } // matches a tag string like "bytes,1,opt,name=repository,proto3" diff --git a/proto/go/gitalypb/namespace.pb.go b/proto/go/gitalypb/namespace.pb.go index aa49ccb42..3858a50d9 100644 --- a/proto/go/gitalypb/namespace.pb.go +++ b/proto/go/gitalypb/namespace.pb.go @@ -366,29 +366,29 @@ func init() { func init() { proto.RegisterFile("namespace.proto", fileDescriptor_ecb1e126f615f5dd) } var fileDescriptor_ecb1e126f615f5dd = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xcd, 0x4e, 0x02, 0x31, - 0x10, 0xc7, 0x43, 0x21, 0x04, 0x47, 0x22, 0xa4, 0x1a, 0x40, 0x34, 0x7e, 0xec, 0x89, 0x8b, 0xbb, - 0x7e, 0x3c, 0x81, 0x26, 0xde, 0x8c, 0x26, 0xcb, 0xcd, 0x98, 0x90, 0x02, 0xe3, 0x4a, 0xc2, 0xd2, - 0xb5, 0xad, 0x44, 0x8f, 0x3e, 0x85, 0xef, 0xea, 0xc9, 0xb4, 0x5d, 0x60, 0x77, 0x29, 0x17, 0xf5, - 0x36, 0xfd, 0xff, 0x67, 0x7f, 0x9d, 0x9d, 0x99, 0x42, 0x63, 0xc6, 0x62, 0x94, 0x09, 0x1b, 0xa1, - 0x9f, 0x08, 0xae, 0x38, 0xad, 0x46, 0x13, 0xc5, 0xa6, 0x1f, 0xdd, 0xba, 0x7c, 0x61, 0x02, 0xc7, - 0x56, 0xf5, 0xee, 0x60, 0xf7, 0x7a, 0x3c, 0xbe, 0x5f, 0xe4, 0x86, 0xf8, 0xfa, 0x86, 0x52, 0xd1, - 0x53, 0xa8, 0x4b, 0xc5, 0x05, 0x8b, 0x70, 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ee, 0x94, 0x0d, 0xfd, - 0x11, 0x8f, 0x03, 0x1b, 0x9e, 0x71, 0x11, 0x05, 0x96, 0x10, 0x98, 0xb7, 0x17, 0x44, 0x3c, 0x3d, - 0x27, 0xc3, 0x61, 0xd5, 0x48, 0x57, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x03, 0xa2, 0x6d, - 0xb7, 0x03, 0x00, 0x00, + // 345 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x4f, 0x4f, 0xfa, 0x40, + 0x10, 0x4d, 0xcb, 0x2f, 0xfc, 0x70, 0x20, 0x42, 0x56, 0x03, 0x88, 0xc6, 0x3f, 0x3d, 0x71, 0xb1, + 0x15, 0xfd, 0x04, 0x9a, 0x78, 0x33, 0x9a, 0xd4, 0xc4, 0x83, 0x17, 0xb2, 0xc0, 0x58, 0x49, 0x28, + 0x5b, 0x77, 0x57, 0xa2, 0x1f, 0xc2, 0xb3, 0xdf, 0xd5, 0x93, 0xd9, 0xdd, 0x02, 0xa5, 0xdd, 0x5e, + 0xd4, 0xdb, 0xcc, 0x7b, 0xd3, 0xf7, 0xa6, 0x33, 0xb3, 0xd0, 0x9c, 0xd3, 0x18, 0x45, 0x42, 0xc7, + 0xe8, 0x27, 0x9c, 0x49, 0x46, 0xaa, 0xd1, 0x54, 0xd2, 0xd9, 0x7b, 0xaf, 0x21, 0x9e, 0x29, 0xc7, + 0x89, 0x41, 0xbd, 0x1b, 0xd8, 0xb9, 0x9c, 0x4c, 0x6e, 0x97, 0xb5, 0x21, 0xbe, 0xbc, 0xa2, 0x90, + 0xe4, 0x04, 0x1a, 0x42, 0x32, 0x4e, 0x23, 0x1c, 0x2a, 0x9d, 0xae, 0x73, 0xec, 0xf4, 0xb7, 0xc2, + 0x7a, 0x8a, 0xa9, 0x72, 0x42, 0xe0, 0x9f, 0xa6, 0x5c, 0x4d, 0xe9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, 0x88, 0x58, 0x9a, 0x27, 0xa3, 0x51, 0x55, 0x43, 0x17, 0xdf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xf1, 0x73, 0x15, 0x86, 0xc3, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/go/gitalypb/shared.pb.go b/proto/go/gitalypb/shared.pb.go index 05bd72e83..4e1985a8d 100644 --- a/proto/go/gitalypb/shared.pb.go +++ b/proto/go/gitalypb/shared.pb.go @@ -133,6 +133,7 @@ type OperationMsg struct { // For example, the following OID refers to a target repo field // nested in a one-of field, both at field one: "1.1" TargetRepositoryField string `protobuf:"bytes,3,opt,name=target_repository_field,json=targetRepositoryField,proto3" json:"target_repository_field,omitempty"` + TargetStorageField string `protobuf:"bytes,4,opt,name=target_storage_field,json=targetStorageField,proto3" json:"target_storage_field,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -184,6 +185,13 @@ func (m *OperationMsg) GetTargetRepositoryField() string { return "" } +func (m *OperationMsg) GetTargetStorageField() string { + if m != nil { + return m.TargetStorageField + } + return "" +} + type Repository struct { StorageName string `protobuf:"bytes,2,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"` RelativePath string `protobuf:"bytes,3,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` @@ -720,62 +728,63 @@ func init() { func init() { proto.RegisterFile("shared.proto", fileDescriptor_d8a4e87e678c5ced) } var fileDescriptor_d8a4e87e678c5ced = []byte{ - // 899 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0x5e, 0x3b, 0xce, 0xdf, 0x89, 0x5b, 0xcc, 0x50, 0x84, 0x55, 0xb4, 0xbb, 0xc1, 0x48, 0xa8, - 0x42, 0x90, 0x56, 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 0x78, 0x57, 0x42, 0xe4, 0xe8, 0x14, 0x60, - 0x87, 0x6e, 0x8e, 0xa9, 0x13, 0x35, 0x75, 0xde, 0x93, 0x0e, 0xef, 0xa0, 0x3e, 0x9f, 0x34, 0x11, - 0x92, 0xbb, 0x92, 0xbe, 0xfd, 0x7d, 0x03, 0xe8, 0x9c, 0xc5, 0xb3, 0xd9, 0x45, 0x12, 0x38, 0xa8, - 0x07, 0xde, 0xe4, 0x75, 0x3c, 0x09, 0x5c, 0xfd, 0x4a, 0xf0, 0x74, 0x1a, 0xb4, 0x50, 0x17, 0x5a, - 0xc9, 0xf8, 0x3c, 0xf0, 0xbe, 0x8a, 0xa1, 0x2b, 0xca, 0x54, 0xe9, 0x00, 0xcf, 0xde, 0xb9, 0xb1, - 0x19, 0x55, 0x2b, 0x91, 0xc5, 0xa5, 0xfe, 0x7e, 0x56, 0xe1, 0xdf, 0xbf, 0x3d, 0x20, 0xcc, 0xee, - 0x57, 0x1b, 0x77, 0x44, 0xa9, 0xcb, 0x98, 0x9c, 0xfc, 0xac, 0xcd, 0x39, 0x59, 0x8c, 0x96, 0xa2, - 0x38, 0xb6, 0xcf, 0x2f, 0x85, 0x64, 0xc7, 0xd6, 0xc9, 0xfe, 0x63, 0x8e, 0x99, 0xa8, 0xe5, 0x72, - 0xb1, 0xe8, 0x18, 0xd5, 0x8b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x2f, 0xad, 0xe3, 0x2d, 0xbd, - 0x06, 0x00, 0x00, + // 913 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x5f, 0x6f, 0xe3, 0x44, + 0x10, 0x3f, 0x3b, 0xce, 0xbf, 0x89, 0x5b, 0xcc, 0x52, 0x84, 0x55, 0x74, 0x77, 0xc1, 0x48, 0xa8, + 0x42, 0x90, 0x56, 0x3d, 0xe9, 0x1e, 0xe0, 0x85, 0xa4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6b, 0xd1, 0x02, + 0xcb, 0xaf, 0x6b, 0x4f, 0xf4, 0x1d, 0x80, 0x15, 0xde, 0x95, 0x10, 0x39, 0x3a, 0x05, 0xd8, 0x91, + 0x9b, 0x63, 0x78, 0xa2, 0x86, 0xe7, 0xbd, 0xe8, 0xf0, 0x0e, 0xea, 0xcb, 0x49, 0x53, 0x21, 0xb9, + 0x2b, 0xe9, 0xbb, 0xdf, 0x37, 0x80, 0xce, 0x59, 0x3c, 0x9b, 0x5d, 0x24, 0x81, 0x83, 0x7a, 0xe0, + 0x4d, 0x5e, 0xc7, 0x93, 0xc0, 0xd5, 0xa7, 0x04, 0x4f, 0xa7, 0x41, 0x0b, 0x75, 0xa1, 0x95, 0x8c, + 0xcf, 0x03, 0xef, 0x9b, 0x18, 0xba, 0xa2, 0x4c, 0x95, 0x2e, 0xf0, 0xec, 0xbd, 0x1d, 0x9b, 0x51, + 0xb5, 0x12, 0x59, 0x5c, 0xea, 0xef, 0x67, 0x15, 0xfe, 0xfd, 0xc7, 0x03, 0xc1, 0xec, 0x7e, 0xe7, + 0x71, 0x47, 0x94, 0x9a, 0xc6, 0xe4, 0xe4, 0x57, 0x1d, 0xce, 0xc9, 0x62, 0xb4, 0x14, 0xc5, 0xb1, + 0x3d, 0x7e, 0x2d, 0x24, 0x3b, 0xb6, 0x49, 0xf6, 0xaf, 0x74, 0xcc, 0x44, 0x6d, 0x97, 0x8b, 0x45, + 0xc7, 0xb8, 0x5e, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0xe6, 0xec, 0x08, 0xa4, 0xef, 0x06, 0x00, + 0x00, } diff --git a/proto/namespace.proto b/proto/namespace.proto index 54ce1ceaa..76e41797d 100644 --- a/proto/namespace.proto +++ b/proto/namespace.proto @@ -10,25 +10,29 @@ service NamespaceService { rpc AddNamespace(AddNamespaceRequest) returns (AddNamespaceResponse) { option (op_type) = { op: MUTATOR - scope_level: STORAGE, + target_storage_field: "1" + scope_level: STORAGE }; } rpc RemoveNamespace(RemoveNamespaceRequest) returns (RemoveNamespaceResponse) { option (op_type) = { op: MUTATOR - scope_level: STORAGE, + target_storage_field: "1" + scope_level: STORAGE }; } rpc RenameNamespace(RenameNamespaceRequest) returns (RenameNamespaceResponse) { option (op_type) = { op: MUTATOR - scope_level: STORAGE, + target_storage_field: "1" + scope_level: STORAGE }; } rpc NamespaceExists(NamespaceExistsRequest) returns (NamespaceExistsResponse) { option (op_type) = { op: ACCESSOR - scope_level: STORAGE, + target_storage_field: "1" + scope_level: STORAGE }; } } diff --git a/proto/shared.proto b/proto/shared.proto index b4c3dbac4..fe9cc8e2b 100644 --- a/proto/shared.proto +++ b/proto/shared.proto @@ -15,19 +15,19 @@ message OperationMsg { } Operation op = 1; - + enum Scope { REPOSITORY = 0; SERVER = 1; STORAGE = 2; } - + // Scope level indicates what level an RPC interacts with a server: // - REPOSITORY: scoped to only a single repo // - SERVER: affects the entire server and potentially all repos // - STORAGE: scoped to a specific storage location and all repos within Scope scope_level = 2; - + // If this operation modifies a repository, this field will // specify the location of the Repository field within the // request message. The field is specified in an OID style @@ -42,6 +42,7 @@ message OperationMsg { // For example, the following OID refers to a target repo field // nested in a one-of field, both at field one: "1.1" string target_repository_field = 3; + string target_storage_field = 4; } enum ObjectType { diff --git a/ruby/proto/gitaly/shared_pb.rb b/ruby/proto/gitaly/shared_pb.rb index 9b4294067..f7a972b47 100644 --- a/ruby/proto/gitaly/shared_pb.rb +++ b/ruby/proto/gitaly/shared_pb.rb @@ -9,6 +9,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :op, :enum, 1, "gitaly.OperationMsg.Operation" optional :scope_level, :enum, 2, "gitaly.OperationMsg.Scope" optional :target_repository_field, :string, 3 + optional :target_storage_field, :string, 4 end add_enum "gitaly.OperationMsg.Operation" do value :UNKNOWN, 0 |