[#49] Minor reformat

- Trying to move enums to the package level
- Trying to keep all definitions in types.proto

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Stanislav Bogatyrev 2020-08-14 22:04:56 +03:00 committed by Alex Vanin
parent e63a482529
commit 7555e166b2
5 changed files with 134 additions and 131 deletions

View file

@ -23,81 +23,82 @@ enum Target {
OTHERS = 3; 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. // EACLRecord groups information about extended ACL rule.
message EACLRecord { 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 carries type of operation.
Operation operation = 1 [json_name = "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 carries ACL target action.
Action action = 2 [json_name = "Action"]; Action action = 2 [json_name = "Action"];
// FilterInfo groups information about filter. // FilterInfo groups information about filter.
message FilterInfo { 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 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 carries type of match.
MatchType match_type = 2 [json_name = "MatchType"]; MatchType match_type = 2 [json_name = "MatchType"];
@ -114,7 +115,7 @@ message EACLRecord {
// TargetInfo groups information about extended ACL target. // TargetInfo groups information about extended ACL target.
message TargetInfo { message TargetInfo {
// target carries target of ACL rule. // 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. // key_list carries public keys of ACL target.
repeated bytes key_list = 2 [json_name="Keys"]; repeated bytes key_list = 2 [json_name="Keys"];

View file

@ -247,24 +247,6 @@ message HeadRequest {
message HeadResponse { message HeadResponse {
// Response body // Response body
message 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 // Carries the requested object header or it's part
oneof head{ oneof head{
// Full object header // Full object header
@ -298,13 +280,6 @@ message SearchRequest {
uint32 version = 2; uint32 version = 2;
// Filter structure // Filter structure
message Filter { 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 // Match type to use
MatchType match_type = 1; MatchType match_type = 1;

View file

@ -21,6 +21,33 @@ enum ObjectType {
STORAGE_GROUP = 2; 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 // Object Headers
message Header { message Header {
// Object's container // Object's container

View file

@ -33,8 +33,8 @@ EACLRecord groups information about extended ACL rule.
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| operation | [EACLRecord.Operation](#neo.fs.v2.acl.EACLRecord.Operation) | | Operation carries type of operation. | | operation | [Operation](#neo.fs.v2.acl.Operation) | | Operation carries type of operation. |
| action | [EACLRecord.Action](#neo.fs.v2.acl.EACLRecord.Action) | | Action carries ACL target action. | | 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. | | 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. | | 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 | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| header | [EACLRecord.FilterInfo.Header](#neo.fs.v2.acl.EACLRecord.FilterInfo.Header) | | Header carries type of header. | | header | [HeaderType](#neo.fs.v2.acl.HeaderType) | | Header carries type of header. |
| match_type | [EACLRecord.FilterInfo.MatchType](#neo.fs.v2.acl.EACLRecord.FilterInfo.MatchType) | | MatchType carries type of match. | | 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_name | [string](#string) | | header_name carries name of filtering header. |
| header_val | [string](#string) | | header_val carries value 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.
<!-- end messages --> <!-- end messages -->
<a name="neo.fs.v2.acl.EACLRecord.Action"></a> <a name="neo.fs.v2.acl.Action"></a>
### EACLRecord.Action ### Action
Action is an enumeration of EACL actions. Action is an enumeration of EACL actions.
| Name | Number | Description | | Name | Number | Description |
@ -92,9 +92,9 @@ Action is an enumeration of EACL actions.
<a name="neo.fs.v2.acl.EACLRecord.FilterInfo.Header"></a> <a name="neo.fs.v2.acl.HeaderType"></a>
### EACLRecord.FilterInfo.Header ### HeaderType
Header is an enumeration of filtering header types. Header is an enumeration of filtering header types.
| Name | Number | Description | | Name | Number | Description |
@ -105,9 +105,9 @@ Header is an enumeration of filtering header types.
<a name="neo.fs.v2.acl.EACLRecord.FilterInfo.MatchType"></a> <a name="neo.fs.v2.acl.MatchType"></a>
### EACLRecord.FilterInfo.MatchType ### MatchType
MatchType is an enumeration of match types. MatchType is an enumeration of match types.
| Name | Number | Description | | Name | Number | Description |
@ -118,9 +118,9 @@ MatchType is an enumeration of match types.
<a name="neo.fs.v2.acl.EACLRecord.Operation"></a> <a name="neo.fs.v2.acl.Operation"></a>
### EACLRecord.Operation ### Operation
Operation is an enumeration of operation types. Operation is an enumeration of operation types.
| Name | Number | Description | | Name | Number | Description |

View file

@ -29,7 +29,6 @@
- [HeadRequest.Body](#neo.fs.v2.object.HeadRequest.Body) - [HeadRequest.Body](#neo.fs.v2.object.HeadRequest.Body)
- [HeadResponse](#neo.fs.v2.object.HeadResponse) - [HeadResponse](#neo.fs.v2.object.HeadResponse)
- [HeadResponse.Body](#neo.fs.v2.object.HeadResponse.Body) - [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](#neo.fs.v2.object.PutRequest)
- [PutRequest.Body](#neo.fs.v2.object.PutRequest.Body) - [PutRequest.Body](#neo.fs.v2.object.PutRequest.Body)
- [PutRequest.Body.Init](#neo.fs.v2.object.PutRequest.Body.Init) - [PutRequest.Body.Init](#neo.fs.v2.object.PutRequest.Body.Init)
@ -50,6 +49,7 @@
- [Header.Attribute](#neo.fs.v2.object.Header.Attribute) - [Header.Attribute](#neo.fs.v2.object.Header.Attribute)
- [Header.Split](#neo.fs.v2.object.Header.Split) - [Header.Split](#neo.fs.v2.object.Header.Split)
- [Object](#neo.fs.v2.object.Object) - [Object](#neo.fs.v2.object.Object)
- [ShortHeader](#neo.fs.v2.object.ShortHeader)
- [Scalar Value Types](#scalar-value-types) - [Scalar Value Types](#scalar-value-types)
@ -406,22 +406,7 @@ Response body
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| header | [Header](#neo.fs.v2.object.Header) | | Full object header | | 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 | | short_header | [ShortHeader](#neo.fs.v2.object.ShortHeader) | | Short object header |
<a name="neo.fs.v2.object.HeadResponse.Body.ShortHeader"></a>
### 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 |
<a name="neo.fs.v2.object.PutRequest"></a> <a name="neo.fs.v2.object.PutRequest"></a>
@ -533,7 +518,7 @@ Filter structure
| Field | Type | Label | Description | | 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 | | name | [string](#string) | | Header name to match |
| value | [string](#string) | | Header value to match | | value | [string](#string) | | Header value to match |
@ -563,18 +548,6 @@ Response body
<!-- end messages --> <!-- end messages -->
<a name="neo.fs.v2.object.SearchRequest.Body.Filter.MatchType"></a>
### SearchRequest.Body.Filter.MatchType
Type of match expression
| Name | Number | Description |
| ---- | ------ | ----------- |
| MATCH_TYPE_UNSPECIFIED | 0 | Unknown. Not used |
| STRING_EQUAL | 1 | Full string match |
<!-- end enums --> <!-- end enums -->
@ -649,9 +622,36 @@ Object structure.
| header | [Header](#neo.fs.v2.object.Header) | | Object metadata headers | | header | [Header](#neo.fs.v2.object.Header) | | Object metadata headers |
| payload | [bytes](#bytes) | | Payload bytes. | | payload | [bytes](#bytes) | | Payload bytes. |
<a name="neo.fs.v2.object.ShortHeader"></a>
### 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 |
<!-- end messages --> <!-- end messages -->
<a name="neo.fs.v2.object.MatchType"></a>
### MatchType
Type of match expression
| Name | Number | Description |
| ---- | ------ | ----------- |
| MATCH_TYPE_UNSPECIFIED | 0 | Unknown. Not used |
| STRING_EQUAL | 1 | Full string match |
<a name="neo.fs.v2.object.ObjectType"></a> <a name="neo.fs.v2.object.ObjectType"></a>
### ObjectType ### ObjectType