From 42e35feffff8d2270e128f13bb78bfb7b018fe0e Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Thu, 13 Aug 2020 00:43:51 +0300 Subject: [PATCH] [#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 --- Makefile | 2 +- accounting/service.proto | 22 ++--- acl/types.proto | 52 ++++++++--- container/service.proto | 106 +++++++++++++---------- container/types.proto | 13 ++- netmap/types.proto | 82 +++++++++++++----- object/service.proto | 183 ++++++++++++++++++++++++--------------- object/types.proto | 46 +++++++--- refs/types.proto | 6 +- service/meta.proto | 67 ++++++++++---- service/verify.proto | 6 +- session/service.proto | 24 ++--- storagegroup/types.proto | 8 +- 13 files changed, 393 insertions(+), 224 deletions(-) diff --git a/Makefile b/Makefile index 76ee25b..6daa283 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ #!/usr/bin/make -f SHELL=bash -# BRanch to match for BRaking changes +# BRanch to match for BReaking changes BRBR?=master .PHONY: lint diff --git a/accounting/service.proto b/accounting/service.proto index b276fdc..4afbcee 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package accounting; +package neo.fs.v2.accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; -option csharp_namespace = "NeoFS.API.Accounting"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting;accounting"; +option csharp_namespace = "NeoFS.API.v2.Accounting"; import "refs/types.proto"; import "service/meta.proto"; @@ -11,7 +11,7 @@ import "service/verify.proto"; // The service provides methods for obtaining information // about the account balance in NeoFS system. -service Accounting { +service AccountingService { // Returns the amount of funds for the requested NeoFS account. rpc Balance (BalanceRequest) returns (BalanceResponse); } @@ -24,23 +24,23 @@ service Accounting { // To gain access to the requested information, the request body must be formed // according to the requirements from the system specification. message BalanceRequest { + //Request body message Body { // Carries user identifier in NeoFS system for which the balance // is requested. - refs.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; } - // Body of the balance 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; } // Decimal represents the decimal numbers. @@ -56,20 +56,20 @@ message Decimal { // // The amount of funds is calculated in decimal numbers. message BalanceResponse { + //Request body message Body { // Carries the amount of funds on the account. Decimal balance = 1; } - // Body of the balance 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; } diff --git a/acl/types.proto b/acl/types.proto index 31731fd..ad7d778 100644 --- a/acl/types.proto +++ b/acl/types.proto @@ -1,16 +1,16 @@ syntax = "proto3"; -package acl; +package neo.fs.v2.acl; -option go_package = "github.com/nspcc-dev/neofs-api-go/acl"; -option csharp_namespace = "NeoFS.API.Acl"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/acl;acl"; +option csharp_namespace = "NeoFS.API.v2.Acl"; import "refs/types.proto"; // Target of the access control rule in access control list. enum Target { - // Unknown target, default value. - UNKNOWN = 0; + // Unspecified target, default value. + TARGET_UNSPECIFIED= 0; // User target rule is applied if sender is the owner of the container. USER = 1; @@ -27,13 +27,28 @@ enum Target { message EACLRecord { // Operation is an enumeration of operation types. enum Operation { - OPERATION_UNKNOWN = 0; + // 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; } @@ -42,8 +57,13 @@ message EACLRecord { // Action is an enumeration of EACL actions. enum Action { - ACTION_UNKNOWN = 0; + // Unspecified action, default value. + ACTION_UNSPECIFIED = 0; + + // Allow action ALLOW = 1; + + // Deny action DENY = 2; } @@ -54,8 +74,13 @@ message EACLRecord { message FilterInfo { // Header is an enumeration of filtering header types. enum Header { - HEADER_UNKNOWN = 0; + // Unspecified header, default value. + HEADER_UNSPECIFIED = 0; + + // Filter request headers REQUEST = 1; + + // Filter object headers OBJECT = 2; } @@ -64,11 +89,15 @@ message EACLRecord { // MatchType is an enumeration of match types. enum MatchType { - MATCH_UNKNOWN = 0; + // 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"]; @@ -90,7 +119,6 @@ message EACLRecord { // key_list carries public keys of ACL target. repeated bytes key_list = 2 [json_name="Keys"]; } - // targets carries information about extended ACL target list. repeated TargetInfo targets = 4 [json_name="Targets"]; } @@ -99,7 +127,7 @@ message EACLRecord { message EACLTable { // Carries identifier of the container that should use given // access control rules. - refs.ContainerID container_id = 1 [json_name="ContainerID"]; + neo.fs.v2.refs.ContainerID container_id = 1 [json_name="ContainerID"]; // Records carries list of extended ACL rule records. repeated EACLRecord records = 2 [json_name="Records"]; diff --git a/container/service.proto b/container/service.proto index dddb38c..c0712ea 100644 --- a/container/service.proto +++ b/container/service.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package container; +package neo.fs.v2.container; -option go_package = "github.com/nspcc-dev/neofs-api-go/container"; -option csharp_namespace = "NeoFS.API.Container"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container;container"; +option csharp_namespace = "NeoFS.API.v2.Container"; import "acl/types.proto"; import "container/types.proto"; @@ -11,9 +11,9 @@ import "refs/types.proto"; import "service/meta.proto"; import "service/verify.proto"; -// Service provides API to access container smart-contract in morph chain +// ContainerService provides API to access container smart-contract in morph chain // via NeoFS node. -service Service { +service ContainerService { // Put invokes 'Put' method in container smart-contract and returns // response immediately. After new block in morph chain, request is verified // by inner ring nodes. After one more block in morph chain, container @@ -43,7 +43,9 @@ service Service { rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse); } +// New NeoFS Container creation request message PutRequest { + // Request body message Body { // Container to create in NeoFS. container.Container container = 1; @@ -55,138 +57,144 @@ message PutRequest { // Signature of stable-marshalled container according to RFC-6979. bytes signature = 3; } - // Body of container put 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; } +// New NeoFS Container creation response message PutResponse { + // Response body message Body { // container_id carries identifier of the new container. - refs.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; } - // Body of container put 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; } +// Container removal request message DeleteRequest { + // Request body message Body { // container_id carries identifier of the container to delete // from NeoFS. - refs.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; // Signature of container id according to RFC-6979. bytes signature = 2; } - // Body of container delete 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 delete operation is asynchronous and done // via consensus in inner ring nodes message DeleteResponse { + // Response body message Body {} - // Body of container delete 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; } +// Get container structure message GetRequest { + // Request body message Body { // container_id carries identifier of the container to get. - refs.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; } - // Body of container get 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 container structure message GetResponse { + // Response body message Body { // Container that has been requested. - container.Container container = 1; + Container container = 1; } - // Body of container get 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; } +// List containers message ListRequest { + // Request body message Body { // owner_id carries identifier of the container owner. - refs.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; } - // Body of list containers 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; } +// List containers message ListResponse { + // Response body message Body { // ContainerIDs carries list of identifiers of the containers that belong to the owner. repeated refs.ContainerID container_ids = 1; @@ -197,37 +205,40 @@ message ListResponse { // 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; } +// Set Extended ACL message SetExtendedACLRequest { + // Request body message Body { // Extended ACL to set for the container. - acl.EACLTable eacl = 1; + neo.fs.v2.acl.EACLTable eacl = 1; // Signature of stable-marshalled Extended ACL according to RFC-6979. bytes signature = 2; } - // Body of set extended acl 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; } +// Set Extended ACL message SetExtendedACLResponse { + // Response body message Body { } // Body of set extended acl response message. @@ -235,18 +246,20 @@ message SetExtendedACLResponse { // 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 Extended ACL message GetExtendedACLRequest { + // Request body message Body { // container_id carries identifier of the container that has Extended ACL. - refs.ContainerID container_id = 1; + neo.fs.v2.refs.ContainerID container_id = 1; } // Body of get extended acl request message. @@ -254,32 +267,33 @@ message GetExtendedACLRequest { // 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 Extended ACL message GetExtendedACLResponse { + // Response body message Body { // Extended ACL that has been requested if it was set up. - acl.EACLTable eacl = 1; + neo.fs.v2.acl.EACLTable eacl = 1; // Signature of stable-marshalled Extended ACL according to RFC-6979. bytes signature = 2; } - // Body of get extended acl 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; } diff --git a/container/types.proto b/container/types.proto index 572c141..10e374a 100644 --- a/container/types.proto +++ b/container/types.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package container; +package neo.fs.v2.container; -option go_package = "github.com/nspcc-dev/neofs-api-go/container"; -option csharp_namespace = "NeoFS.API.Container"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container;container"; +option csharp_namespace = "NeoFS.API.v2.Container"; import "netmap/types.proto"; import "refs/types.proto"; @@ -14,7 +14,7 @@ import "refs/types.proto"; // SHA256 hash of stable-marshalled container message. message Container { // OwnerID carries identifier of the container owner. - refs.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; // Nonce is a 16 byte UUID, used to avoid collisions of container id. bytes nonce = 2; @@ -31,10 +31,9 @@ message Container { // Value of immutable container attribute. string value = 2; } - // Attributes define any immutable characteristics of container. repeated Attribute attributes = 4; - // Rules define storage policy for the object inside the container. - netmap.PlacementRule rules = 5; + // Placement policy for the object inside the container. + neo.fs.v2.netmap.PlacementPolicy placement_policy = 5; } diff --git a/netmap/types.proto b/netmap/types.proto index 44866d2..37fadaf 100644 --- a/netmap/types.proto +++ b/netmap/types.proto @@ -1,84 +1,118 @@ syntax = "proto3"; -package netmap; +package neo.fs.v2.netmap; -option go_package = "github.com/nspcc-dev/neofs-api-go/netmap"; -option csharp_namespace = "NeoFS.API.Netmap"; +option go_package = "github.com/nspcc-dev/neofs-api-go/netmap;netmap"; +option csharp_namespace = "NeoFS.API.v2.Netmap"; -message PlacementRule { +// Set of rules to select a subset of nodes able to store container's objects +message PlacementPolicy { + // Replication factor uint32 repl_factor = 1; - message SFGroup { + // Filters to apply to Network Map + message FilterGroup { + // Filter definition message Filter { + // Filter identifier string key = 1; - message SimpleFilters { - repeated SimpleFilter filters = 1; - } - + // Minimal simple filter message SimpleFilter { + // Filtering operation enum Operation { - NP = 0; + // No Operation defined + OPERATION_UNSPECIFIED= 0; + + // Equal EQ = 1; + + // Not Equal NE = 2; + + // Greater then GT = 3; + + // Greater or equal GE = 4; + + // Less then LT = 5; + + // Less or equal LE = 6; + + // Logical OR OR = 7; + + // Logical AND AND = 8; } - + // Filtering operation Operation op = 1; + // List of filters + message SimpleFilters { + // List of filters + repeated SimpleFilter filters = 1; + } + + // Filtering operation argument oneof args { + // Value string value = 2; + // Result of other filter application SimpleFilters f_args = 3; } } - + // The rest of filter SimpleFilter f = 2; } + // Resulting filter list repeated Filter filters = 1; + // Selector message Selector { + // How many to select uint32 count = 1; + // Key to select string key = 2; } + // List of selectors repeated Selector selectors = 2; + // Parts of graph to exclude. Internal use. repeated uint32 exclude = 3; } - - repeated SFGroup sf_groups = 2; + // List of filter groups + repeated FilterGroup filter_groups = 2; } -// Groups the information about the NeoFS node. +// NeoFS node description message NodeInfo { - // Carries network address of the NeoFS node. + // Ways to connect to a node string address = 1; - // Carries public key of the NeoFS node in a binary format. + // Public key of the NeoFS node in a binary format. bytes public_key = 2; - // Groups attributes of the NeoFS node. + // Attributes of the NeoFS node. message Attribute { - // Carries string key to the node attribute. + // Key of the node attribute. string key = 1; - // Carries string value of the node attribute. + // Value of the node attribute. string value = 2; } - // Carries list of the NeoFS node attributes in a string key-value format. repeated Attribute attributes = 3; // Represents the enumeration of various states of the NeoFS node. enum State { - // Undefined state. - UNKNOWN = 0; + // Unknown state. + UNSPECIFIED = 0; // Active state in the network. ONLINE = 1; @@ -89,4 +123,4 @@ message NodeInfo { // Carries state of the NeoFS node. State state = 4; -} \ No newline at end of file +} diff --git a/object/service.proto b/object/service.proto index df5d6ab..04ecb1f 100644 --- a/object/service.proto +++ b/object/service.proto @@ -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; } - diff --git a/object/types.proto b/object/types.proto index 3ec02cb..05f4571 100644 --- a/object/types.proto +++ b/object/types.proto @@ -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; } diff --git a/refs/types.proto b/refs/types.proto index 0b5fcff..1ffb033 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package refs; +package neo.fs.v2.refs; -option go_package = "github.com/nspcc-dev/neofs-api-go/refs"; -option csharp_namespace = "NeoFS.API.Refs"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/refs;refs"; +option csharp_namespace = "NeoFS.API.v2.Refs"; // Address of object (container id + object id) message Address { diff --git a/service/meta.proto b/service/meta.proto index 2e51d92..e74a606 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -1,17 +1,19 @@ syntax = "proto3"; -package service; +package neo.fs.v2.service; -option go_package = "github.com/nspcc-dev/neofs-api-go/service"; -option csharp_namespace = "NeoFS.API.Service"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service;service"; +option csharp_namespace = "NeoFS.API.v2.Service"; import "acl/types.proto"; import "refs/types.proto"; import "service/verify.proto"; +// Extended headers for Request/Response message XHeader { // Key of the X-Header. string key = 1; + // Value of the X-Header. string value = 2; } @@ -20,6 +22,7 @@ message XHeader { message Version { // Major API version. uint32 major = 1; + // Minor API version. uint32 minor = 2; } @@ -28,50 +31,67 @@ message Version { message TokenLifetime { // Expiration Epoch uint64 exp = 1; + // Not valid before Epoch uint64 nbf = 2; + // Issued at Epoch uint64 iat = 3; } // NeoFS session token. message SessionToken { + // Session token body message Body { // ID is a token identifier. valid UUIDv4 represented in bytes bytes id = 1; + // OwnerID carries identifier of the session initiator. - refs.OwnerID owner_id = 2; + neo.fs.v2.refs.OwnerID owner_id = 2; + // Verb is an enumeration of session request types enum Verb { + // Unknown verb + VERB_UNSPECIFIED = 0; + // Refers to object.Put RPC call - OBJECT_PUT = 0; + OBJECT_PUT = 1; + // Refers to object.Get RPC call - OBJECT_GET = 1; + OBJECT_GET = 2; + // Refers to object.Head RPC call - OBJECT_HEAD = 2; + OBJECT_HEAD = 3; + // Refers to object.Search RPC call - OBJECT_SEARCH = 3; + OBJECT_SEARCH = 4; + // Refers to object.Delete RPC call - OBJECT_DELETE = 4; + OBJECT_DELETE = 5; + // Refers to object.GetRange RPC call - OBJECT_RANGE = 5; + OBJECT_RANGE = 6; + // Refers to object.GetRangeHash RPC call - OBJECT_RANGEHASH = 6; + OBJECT_RANGEHASH = 7; } // Verb is a type of request for which the token is issued Verb verb = 3; + // Lifetime is a lifetime of the session TokenLifetime lifetime = 4; + // SessionKey is a public key of session key bytes session_key = 5; + // Carries context of the session. oneof context { // object_address represents the object session context. - refs.Address object_address = 6; + neo.fs.v2.refs.Address object_address = 6; } } // Session Token body - Body token = 1; + Body body = 1; // Signature is a signature of session token information Signature signature = 2; @@ -79,16 +99,19 @@ message SessionToken { // BearerToken has information about request ACL rules with limited lifetime message BearerToken { + // Bearer Token body message Body { // EACLTable carries table of extended ACL rules - acl.EACLTable eacl_table = 1; + neo.fs.v2.acl.EACLTable eacl_table = 1; + // OwnerID carries identifier of the token owner - refs.OwnerID owner_id = 2; + neo.fs.v2.refs.OwnerID owner_id = 2; + // Token expiration and valid time period parameters TokenLifetime lifetime = 3; } // Bearer Token body - Body token = 1; + Body body = 1; // Signature of BearerToken body Signature signature = 2; @@ -98,16 +121,21 @@ message BearerToken { message RequestMetaHeader { // Client API version. Version version = 1; + // Client local epoch number. Set to 0 if unknown. uint64 epoch = 2; + // Maximum number of nodes in the request route. uint32 ttl = 3; + // Request X-Headers. repeated XHeader x_headers = 4; + // Token is a token of the session within which the request is sent - SessionToken token = 5; + SessionToken session_token = 5; + // Bearer is a Bearer token of the request - BearerToken bearer = 6; + BearerToken bearer_token = 6; // RequestMetaHeader of the origin request. RequestMetaHeader origin = 7; @@ -117,10 +145,13 @@ message RequestMetaHeader { message ResponseMetaHeader { // Server API version. Version version = 1; + // Server local epoch number. uint64 epoch = 2; + // Maximum number of nodes in the response route. uint32 ttl = 3; + // Response X-Headers. repeated XHeader x_headers = 4; diff --git a/service/verify.proto b/service/verify.proto index 0c8e39f..77745c6 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package service; +package neo.fs.v2.service; -option go_package = "github.com/nspcc-dev/neofs-api-go/service"; -option csharp_namespace = "NeoFS.API.Service"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service;service"; +option csharp_namespace = "NeoFS.API.v2.Service"; import "acl/types.proto"; import "refs/types.proto"; diff --git a/session/service.proto b/session/service.proto index 6227800..94281a7 100644 --- a/session/service.proto +++ b/session/service.proto @@ -1,43 +1,45 @@ syntax = "proto3"; -package session; +package neo.fs.v2.session; -option go_package = "github.com/nspcc-dev/neofs-api-go/session"; -option csharp_namespace = "NeoFS.API.Session"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session;session"; +option csharp_namespace = "NeoFS.API.v2.Session"; import "refs/types.proto"; import "service/meta.proto"; import "service/verify.proto"; -service Session { +// Create Session record on Node side +service SessionService { // Create opens new session between the client and the server. rpc Create (CreateRequest) returns (CreateResponse); } // CreateRequest carries an information necessary for opening a session. message CreateRequest { + // Request body message Body { // Carries an identifier of a session initiator. - refs.OwnerID owner_id = 1; + neo.fs.v2.refs.OwnerID owner_id = 1; // Carries a lifetime of the session. - service.TokenLifetime lifetime = 2; + neo.fs.v2.service.TokenLifetime lifetime = 2; } - // Body of create session token 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; } // CreateResponse carries an information about the opened session. message CreateResponse { + // Response body message Body { // id carries an identifier of session token. bytes id = 1; @@ -51,10 +53,10 @@ message CreateResponse { // 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; } diff --git a/storagegroup/types.proto b/storagegroup/types.proto index 20b5425..94cefc3 100644 --- a/storagegroup/types.proto +++ b/storagegroup/types.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package storagegroup; +package neo.fs.v2.storagegroup; -option go_package = "github.com/nspcc-dev/neofs-api-go/storagegroup"; -option csharp_namespace = "NeoFS.API.StorageGroup"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/storagegroup;storagegroup"; +option csharp_namespace = "NeoFS.API.v2.StorageGroup"; import "refs/types.proto"; @@ -26,5 +26,5 @@ message StorageGroup { // Members carries the list of identifiers of the object storage group members. // The list is strictly ordered. - repeated refs.ObjectID members = 4; + repeated neo.fs.v2.refs.ObjectID members = 4; }