[#45] Fix linter errors

- Changed package names adding version
- Added documentation descriptions (sometimes useless) for all fields
- Changed enum format
- Made SessionToken and BearerToken field names more clear

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Stanislav Bogatyrev 2020-08-13 00:43:51 +03:00 committed by Alex Vanin
parent 35d1d34ee0
commit 42e35fefff
13 changed files with 393 additions and 224 deletions

View file

@ -1,9 +1,9 @@
syntax = "proto3";
package object;
package neo.fs.v2.object;
option go_package = "github.com/nspcc-dev/neofs-api-go/object";
option csharp_namespace = "NeoFS.API.Object";
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object;object";
option csharp_namespace = "NeoFS.API.v2.Object";
import "object/types.proto";
import "refs/types.proto";
@ -11,7 +11,7 @@ import "service/meta.proto";
import "service/verify.proto";
// Object service provides API for manipulating with the object.
service Service {
service ObjectService {
// Get the object from container. Response uses gRPC stream. First response
// message carry object of requested address. Chunk messages are parts of
// the object's payload if it is needed. All messages except first carry
@ -52,10 +52,12 @@ service Service {
rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse);
}
// Get object request
message GetRequest {
// Request body
message Body {
// Address of the requested object.
refs.Address address = 1;
neo.fs.v2.refs.Address address = 1;
// Carries the raw option flag of the request.
// Raw request is sent to receive only the objects
@ -67,21 +69,25 @@ message GetRequest {
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
service.RequestMetaHeader meta_header = 2;
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
service.RequestVerificationHeader verify_header = 3;
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// get object response
message GetResponse {
// Response body
message Body {
// Initialization parameters of the object got from NeoFS.
message Init {
// Object ID
refs.ObjectID object_id = 1;
neo.fs.v2.refs.ObjectID object_id = 1;
// Object signature
service.Signature signature =2;
neo.fs.v2.service.Signature signature =2;
// Object header.
Header header = 3;
}
@ -89,6 +95,7 @@ message GetResponse {
oneof object_part {
// Initialization parameters of the object stream.
Init init =1;
// Part of the object payload.
bytes chunk = 2;
}
@ -98,34 +105,39 @@ message GetResponse {
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
service.ResponseMetaHeader meta_header = 2;
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
service.ResponseVerificationHeader verify_header = 3;
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
// Put object request
message PutRequest {
// Request body
message Body {
// Groups initialization parameters of object placement in NeoFS.
message Init {
// Object ID, where available
refs.ObjectID object_id = 1;
neo.fs.v2.refs.ObjectID object_id = 1;
// Object signature, were available
service.Signature signature =2;
neo.fs.v2.service.Signature signature =2;
// Header of the object to save in the system.
Header header = 3;
// Number of the object copies to store within the RPC call.
// Default zero value is processed according to the
// container placement rules.
uint32 copies_number = 4;
}
// Carries the single part of the query stream.
oneof object_part {
// Carries the initialization parameters of the object stream.
Init init = 1;
// Carries part of the object payload.
bytes chunk = 2;
}
@ -135,54 +147,60 @@ message PutRequest {
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
service.RequestMetaHeader meta_header = 2;
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
service.RequestVerificationHeader verify_header = 3;
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// Put object response
message PutResponse {
// Response body
message Body {
// Carries identifier of the saved object.
// It is used to access an object in the container.
refs.ObjectID object_id = 1;
neo.fs.v2.refs.ObjectID object_id = 1;
}
// Body of put object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
service.ResponseMetaHeader meta_header = 2;
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
service.ResponseVerificationHeader verify_header = 3;
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
// Object Delete request
message DeleteRequest {
// Request body
message Body {
// Carries the address of the object to be deleted.
refs.Address address = 1;
neo.fs.v2.refs.Address address = 1;
// Carries identifier the object owner.
refs.OwnerID owner_id = 2;
neo.fs.v2.refs.OwnerID owner_id = 2;
}
// Body of delete object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
service.RequestMetaHeader meta_header = 2;
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
service.RequestVerificationHeader verify_header = 3;
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// DeleteResponse is empty because we cannot guarantee permanent object removal
// in distributed system.
message DeleteResponse {
// Response body
message Body { }
// Body of delete object response message.
@ -190,20 +208,24 @@ message DeleteResponse {
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
service.ResponseMetaHeader meta_header = 2;
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
service.ResponseVerificationHeader verify_header = 3;
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
// Object head request
message HeadRequest {
// Request body
message Body {
// Address of the object with the requested header.
refs.Address address = 1;
neo.fs.v2.refs.Address address = 1;
// Return only minimal header subset
bool main_only = 2;
// Carries the raw option flag of the request.
// Raw request is sent to receive only the headers of the objects
// that are physically stored on the server.
@ -214,31 +236,41 @@ message HeadRequest {
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
service.RequestMetaHeader meta_header = 2;
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
service.RequestVerificationHeader verify_header = 3;
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// Head response
message HeadResponse {
// Response body
message Body {
// Short header fields
message ShortHeader {
// Object format version.
service.Version version = 1;
neo.fs.v2.service.Version version = 1;
// Epoch when the object was created
uint64 creation_epoch = 2;
// Object's owner
refs.OwnerID owner_id = 3;
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
Header header = 1;
// Short object header
ShortHeader short_header = 2;
}
}
@ -247,70 +279,74 @@ message HeadResponse {
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
service.ResponseMetaHeader meta_header = 2;
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
service.ResponseVerificationHeader verify_header = 3;
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
// Search objects request
message SearchRequest {
// Request body
message Body {
// Carries search container identifier.
refs.ContainerID container_id = 1;
neo.fs.v2.refs.ContainerID container_id = 1;
message Query {
uint32 version = 1;
message Filter {
enum MatchType {
MATCH_UNKNOWN = 0;
STRING_EQUAL = 1;
}
MatchType match_type = 1;
string name = 2;
string value = 3;
// Version of the Query Language used
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;
repeated Filter filters = 2;
// Header name to match
string name = 2;
// Header value to match
string value = 3;
}
Query query = 2;
// List of search expressions
repeated Filter filters = 3;
}
// Body of search object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
service.RequestMetaHeader meta_header = 2;
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
service.RequestVerificationHeader verify_header = 3;
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// Search response
message SearchResponse {
// Response body
message Body {
// Carries list of object identifiers that match the search query.
repeated refs.ObjectID id_list = 1;
// Carries list of object identifiers that match the search query
repeated neo.fs.v2.refs.ObjectID id_list = 1;
}
// Body of search object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
service.ResponseMetaHeader meta_header = 2;
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
service.ResponseVerificationHeader verify_header = 3;
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
// Range groups the parameters of object payload range.
@ -322,10 +358,12 @@ message Range {
uint64 length = 2;
}
// Request to get part of object's payload
message GetRangeRequest {
// Request Body
message Body {
// Address carries address of the object that contains the requested payload range.
refs.Address address = 1;
neo.fs.v2.refs.Address address = 1;
// Range carries the parameters of the requested payload range.
Range range = 2;
@ -336,14 +374,16 @@ message GetRangeRequest {
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
service.RequestMetaHeader meta_header = 2;
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
service.RequestVerificationHeader verify_header = 3;
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// Get part of object's payload
message GetRangeResponse {
// Response body
message Body {
// Carries part of the object payload.
bytes chunk = 1;
@ -354,18 +394,20 @@ message GetRangeResponse {
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
service.ResponseMetaHeader meta_header = 2;
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
service.ResponseVerificationHeader verify_header = 3;
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
// Get hash of object's payload part
message GetRangeHashRequest {
// Request body
message Body {
// Carries address of the object that contains the requested payload range.
refs.Address address = 1;
neo.fs.v2.refs.Address address = 1;
// Carries the list of object payload range to calculate homomorphic hash.
repeated Range ranges = 2;
@ -373,35 +415,34 @@ message GetRangeHashRequest {
// Carries binary salt to XOR object payload ranges before hash calculation.
bytes salt = 3;
}
// Body of get range hash object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
service.RequestMetaHeader meta_header = 2;
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
service.RequestVerificationHeader verify_header = 3;
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// Get hash of object's payload part
message GetRangeHashResponse {
// Response body
message Body {
// Carries list of homomorphic hashes in a binary format.
repeated bytes hash_list = 1;
}
// Body of get range hash object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
service.ResponseMetaHeader meta_header = 2;
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
service.ResponseVerificationHeader verify_header = 3;
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}

View file

@ -1,9 +1,9 @@
syntax = "proto3";
package object;
package neo.fs.v2.object;
option go_package = "github.com/nspcc-dev/neofs-api-go/object";
option csharp_namespace = "NeoFS.API.Object";
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object;object";
option csharp_namespace = "NeoFS.API.v2.Object";
import "refs/types.proto";
import "service/meta.proto";
@ -13,33 +13,45 @@ import "service/verify.proto";
enum ObjectType {
// Just a normal object
REGULAR = 0;
// Used internally to identify deleted objects
TOMBSTONE = 1;
// Identifies that the object holds StorageGroup information
STORAGE_GROUP = 2;
}
// Object Headers
message Header {
// Object's container
refs.ContainerID container_id = 1;
neo.fs.v2.refs.ContainerID container_id = 1;
// Object's owner
refs.OwnerID owner_id = 2;
neo.fs.v2.refs.OwnerID owner_id = 2;
// Epoch when the object was created
uint64 creation_epoch = 3;
// Object format version.
// Effectively the version of API library used to create particular object
service.Version version = 4;
neo.fs.v2.service.Version version = 4;
// Size of payload in bytes.
// 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown
uint64 payload_length = 5;
// Hash of payload bytes
bytes payload_hash = 6;
// Special object type
ObjectType object_type = 7;
// Homomorphic hash of the object payload.
bytes homomorphic_hash = 8;
// Session token, if it was used during Object creation.
// Need it to verify integrity and authenticity out of Request scope.
service.SessionToken session_token = 9;
neo.fs.v2.service.SessionToken session_token = 9;
// Attribute groups the user-defined Key-Value pairs attached to the object
message Attribute {
@ -48,6 +60,7 @@ message Header {
// string value of the object attribute
string value = 2;
}
// User-defined object attributes
repeated Attribute attributes = 10;
// Information about spawning the objects through a payload splitting.
@ -55,15 +68,19 @@ message Header {
// Identifier of the origin object.
// Parent and children objects must be within the same container.
// Parent object_id is known only to the minor child.
refs.ObjectID parent = 1;
neo.fs.v2.refs.ObjectID parent = 1;
// Previous carries identifier of the left split neighbor.
refs.ObjectID previous = 2;
neo.fs.v2.refs.ObjectID previous = 2;
// `signature` field of the parent object. Used to reconstruct parent.
service.Signature parent_signature = 3;
neo.fs.v2.service.Signature parent_signature = 3;
// `header` field of the parent object. Used to reconstruct parent.
Header parent_header = 4;
// Children carries list of identifiers of the objects generated by splitting the current.
repeated refs.ObjectID children = 5;
repeated neo.fs.v2.refs.ObjectID children = 5;
}
// Position of the object in the split hierarchy.
Split split = 11;
@ -75,11 +92,14 @@ message Object {
// Object is content-addressed. It means id will change if header or payload
// changes. It's calculated as a hash of header field, which contains hash of
// object's payload
refs.ObjectID object_id = 1;
neo.fs.v2.refs.ObjectID object_id = 1;
// Signed object_id
service.Signature signature = 2;
neo.fs.v2.service.Signature signature = 2;
// Object metadata headers
Header header = 3;
// Payload bytes.
bytes payload = 4;
}