From 7555e166b2a4a1314d4895d45aaf9f27aa9a53d8 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Fri, 14 Aug 2020 22:04:56 +0300 Subject: [PATCH] [#49] Minor reformat - Trying to move enums to the package level - Trying to keep all definitions in types.proto Signed-off-by: Stanislav Bogatyrev --- acl/types.proto | 129 ++++++++++++++++++++++--------------------- object/service.proto | 25 --------- object/types.proto | 27 +++++++++ proto-docs/acl.md | 24 ++++---- proto-docs/object.md | 60 ++++++++++---------- 5 files changed, 134 insertions(+), 131 deletions(-) diff --git a/acl/types.proto b/acl/types.proto index edb3649..9a38775 100644 --- a/acl/types.proto +++ b/acl/types.proto @@ -23,81 +23,82 @@ enum Target { OTHERS = 3; } +// MatchType is an enumeration of match types. +enum MatchType { + // Unspecified match type, default value. + MATCH_TYPE_UNSPECIFIED = 0; + + // Return true if strings are equal + STRING_EQUAL = 1; + + // Return true if strings are different + STRING_NOT_EQUAL = 2; +} + +// Operation is an enumeration of operation types. +enum Operation { + // Unspecified operation, default value. + OPERATION_UNSPECIFIED = 0; + + // Get + GET = 1; + + // Head + HEAD = 2; + + // Put + PUT = 3; + + // Delete + DELETE = 4; + + // Search + SEARCH = 5; + + // GetRange + GETRANGE = 6; + + // GetRangeHash + GETRANGEHASH = 7; +} + +// Action is an enumeration of EACL actions. +enum Action { + // Unspecified action, default value. + ACTION_UNSPECIFIED = 0; + + // Allow action + ALLOW = 1; + + // Deny action + DENY = 2; +} + +// Header is an enumeration of filtering header types. +enum HeaderType { + // Unspecified header, default value. + HEADER_UNSPECIFIED = 0; + + // Filter request headers + REQUEST = 1; + + // Filter object headers + OBJECT = 2; +} + // EACLRecord groups information about extended ACL rule. message EACLRecord { - // Operation is an enumeration of operation types. - enum Operation { - // Unspecified operation, default value. - OPERATION_UNSPECIFIED = 0; - - // Get - GET = 1; - - // Head - HEAD = 2; - - // Put - PUT = 3; - - // Delete - DELETE = 4; - - // Search - SEARCH = 5; - - // GetRange - GETRANGE = 6; - - // GetRangeHash - GETRANGEHASH = 7; - } - // Operation carries type of operation. Operation operation = 1 [json_name = "Operation"]; - // Action is an enumeration of EACL actions. - enum Action { - // Unspecified action, default value. - ACTION_UNSPECIFIED = 0; - - // Allow action - ALLOW = 1; - - // Deny action - DENY = 2; - } - // Action carries ACL target action. Action action = 2 [json_name = "Action"]; // FilterInfo groups information about filter. message FilterInfo { - // Header is an enumeration of filtering header types. - enum Header { - // Unspecified header, default value. - HEADER_UNSPECIFIED = 0; - - // Filter request headers - REQUEST = 1; - - // Filter object headers - OBJECT = 2; - } - // Header carries type of header. - Header header = 1 [json_name = "HeaderType"]; + HeaderType header = 1 [json_name = "HeaderType"]; - // MatchType is an enumeration of match types. - enum MatchType { - // Unspecified match type, default value. - MATCH_TYPE_UNSPECIFIED = 0; - - // Return true if strings are equal - STRING_EQUAL = 1; - - // Return true if strings are different - STRING_NOT_EQUAL = 2; - } // MatchType carries type of match. MatchType match_type = 2 [json_name = "MatchType"]; @@ -114,7 +115,7 @@ message EACLRecord { // TargetInfo groups information about extended ACL target. message TargetInfo { // target carries target of ACL rule. - acl.Target target = 1 [json_name="Role"]; + Target target = 1 [json_name="Role"]; // key_list carries public keys of ACL target. repeated bytes key_list = 2 [json_name="Keys"]; diff --git a/object/service.proto b/object/service.proto index 7bb3248..bbd466f 100644 --- a/object/service.proto +++ b/object/service.proto @@ -247,24 +247,6 @@ message HeadRequest { message HeadResponse { // Response body message Body { - // Short header fields - message ShortHeader { - // Object format version. - neo.fs.v2.service.Version version = 1; - - // Epoch when the object was created - uint64 creation_epoch = 2; - - // Object's owner - neo.fs.v2.refs.OwnerID owner_id = 3; - - // Type of the object payload content - ObjectType object_type = 4; - - // Size of payload in bytes. - // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown - uint64 payload_length = 5; - } // Carries the requested object header or it's part oneof head{ // Full object header @@ -298,13 +280,6 @@ message SearchRequest { uint32 version = 2; // Filter structure message Filter { - // Type of match expression - enum MatchType { - // Unknown. Not used - MATCH_TYPE_UNSPECIFIED = 0; - // Full string match - STRING_EQUAL = 1; - } // Match type to use MatchType match_type = 1; diff --git a/object/types.proto b/object/types.proto index 35a2a07..89edf9b 100644 --- a/object/types.proto +++ b/object/types.proto @@ -21,6 +21,33 @@ enum ObjectType { STORAGE_GROUP = 2; } +// Type of match expression +enum MatchType { + // Unknown. Not used + MATCH_TYPE_UNSPECIFIED = 0; + // Full string match + STRING_EQUAL = 1; +} + +// Short header fields +message ShortHeader { + // Object format version. + neo.fs.v2.service.Version version = 1; + + // Epoch when the object was created + uint64 creation_epoch = 2; + + // Object's owner + neo.fs.v2.refs.OwnerID owner_id = 3; + + // Type of the object payload content + ObjectType object_type = 4; + + // Size of payload in bytes. + // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown + uint64 payload_length = 5; +} + // Object Headers message Header { // Object's container diff --git a/proto-docs/acl.md b/proto-docs/acl.md index b2adaf6..b653ec9 100644 --- a/proto-docs/acl.md +++ b/proto-docs/acl.md @@ -33,8 +33,8 @@ EACLRecord groups information about extended ACL rule. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| operation | [EACLRecord.Operation](#neo.fs.v2.acl.EACLRecord.Operation) | | Operation carries type of operation. | -| action | [EACLRecord.Action](#neo.fs.v2.acl.EACLRecord.Action) | | Action carries ACL target action. | +| operation | [Operation](#neo.fs.v2.acl.Operation) | | Operation carries type of operation. | +| action | [Action](#neo.fs.v2.acl.Action) | | Action carries ACL target action. | | filters | [EACLRecord.FilterInfo](#neo.fs.v2.acl.EACLRecord.FilterInfo) | repeated | filters carries set of filters. | | targets | [EACLRecord.TargetInfo](#neo.fs.v2.acl.EACLRecord.TargetInfo) | repeated | targets carries information about extended ACL target list. | @@ -47,8 +47,8 @@ FilterInfo groups information about filter. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| header | [EACLRecord.FilterInfo.Header](#neo.fs.v2.acl.EACLRecord.FilterInfo.Header) | | Header carries type of header. | -| match_type | [EACLRecord.FilterInfo.MatchType](#neo.fs.v2.acl.EACLRecord.FilterInfo.MatchType) | | MatchType carries type of match. | +| header | [HeaderType](#neo.fs.v2.acl.HeaderType) | | Header carries type of header. | +| match_type | [MatchType](#neo.fs.v2.acl.MatchType) | | MatchType carries type of match. | | header_name | [string](#string) | | header_name carries name of filtering header. | | header_val | [string](#string) | | header_val carries value of filtering header. | @@ -79,9 +79,9 @@ EACLRecord carries the information about extended ACL rules. - + -### EACLRecord.Action +### Action Action is an enumeration of EACL actions. | Name | Number | Description | @@ -92,9 +92,9 @@ Action is an enumeration of EACL actions. - + -### EACLRecord.FilterInfo.Header +### HeaderType Header is an enumeration of filtering header types. | Name | Number | Description | @@ -105,9 +105,9 @@ Header is an enumeration of filtering header types. - + -### EACLRecord.FilterInfo.MatchType +### MatchType MatchType is an enumeration of match types. | Name | Number | Description | @@ -118,9 +118,9 @@ MatchType is an enumeration of match types. - + -### EACLRecord.Operation +### Operation Operation is an enumeration of operation types. | Name | Number | Description | diff --git a/proto-docs/object.md b/proto-docs/object.md index 94fc650..5f79a90 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -29,7 +29,6 @@ - [HeadRequest.Body](#neo.fs.v2.object.HeadRequest.Body) - [HeadResponse](#neo.fs.v2.object.HeadResponse) - [HeadResponse.Body](#neo.fs.v2.object.HeadResponse.Body) - - [HeadResponse.Body.ShortHeader](#neo.fs.v2.object.HeadResponse.Body.ShortHeader) - [PutRequest](#neo.fs.v2.object.PutRequest) - [PutRequest.Body](#neo.fs.v2.object.PutRequest.Body) - [PutRequest.Body.Init](#neo.fs.v2.object.PutRequest.Body.Init) @@ -50,6 +49,7 @@ - [Header.Attribute](#neo.fs.v2.object.Header.Attribute) - [Header.Split](#neo.fs.v2.object.Header.Split) - [Object](#neo.fs.v2.object.Object) + - [ShortHeader](#neo.fs.v2.object.ShortHeader) - [Scalar Value Types](#scalar-value-types) @@ -406,22 +406,7 @@ Response body | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | header | [Header](#neo.fs.v2.object.Header) | | Full object header | -| short_header | [HeadResponse.Body.ShortHeader](#neo.fs.v2.object.HeadResponse.Body.ShortHeader) | | Short object header | - - - - -### Message HeadResponse.Body.ShortHeader -Short header fields - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| version | [neo.fs.v2.service.Version](#neo.fs.v2.service.Version) | | Object format version. | -| creation_epoch | [uint64](#uint64) | | Epoch when the object was created | -| owner_id | [neo.fs.v2.refs.OwnerID](#neo.fs.v2.refs.OwnerID) | | Object's owner | -| object_type | [ObjectType](#neo.fs.v2.object.ObjectType) | | Type of the object payload content | -| payload_length | [uint64](#uint64) | | Size of payload in bytes. 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown | +| short_header | [ShortHeader](#neo.fs.v2.object.ShortHeader) | | Short object header | @@ -533,7 +518,7 @@ Filter structure | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| match_type | [SearchRequest.Body.Filter.MatchType](#neo.fs.v2.object.SearchRequest.Body.Filter.MatchType) | | Match type to use | +| match_type | [MatchType](#neo.fs.v2.object.MatchType) | | Match type to use | | name | [string](#string) | | Header name to match | | value | [string](#string) | | Header value to match | @@ -563,18 +548,6 @@ Response body - - - -### SearchRequest.Body.Filter.MatchType -Type of match expression - -| Name | Number | Description | -| ---- | ------ | ----------- | -| MATCH_TYPE_UNSPECIFIED | 0 | Unknown. Not used | -| STRING_EQUAL | 1 | Full string match | - - @@ -649,9 +622,36 @@ Object structure. | header | [Header](#neo.fs.v2.object.Header) | | Object metadata headers | | payload | [bytes](#bytes) | | Payload bytes. | + + + +### Message ShortHeader +Short header fields + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| version | [neo.fs.v2.service.Version](#neo.fs.v2.service.Version) | | Object format version. | +| creation_epoch | [uint64](#uint64) | | Epoch when the object was created | +| owner_id | [neo.fs.v2.refs.OwnerID](#neo.fs.v2.refs.OwnerID) | | Object's owner | +| object_type | [ObjectType](#neo.fs.v2.object.ObjectType) | | Type of the object payload content | +| payload_length | [uint64](#uint64) | | Size of payload in bytes. 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown | + + + +### MatchType +Type of match expression + +| Name | Number | Description | +| ---- | ------ | ----------- | +| MATCH_TYPE_UNSPECIFIED | 0 | Unknown. Not used | +| STRING_EQUAL | 1 | Full string match | + + + ### ObjectType