diff --git a/Makefile b/Makefile index 1c2420f..ce789e4 100644 --- a/Makefile +++ b/Makefile @@ -19,3 +19,7 @@ doc: --proto_path=.:/usr/local/include \ --doc_out=proto-docs/ $${f}/*.proto; \ done + +.PHONY: format +format: + buf format -w diff --git a/README.md b/README.md index ce5ad24..95b3485 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ This repository contains: - protocol buffers packages - [auto-generated docs](proto-docs) for protocol buffers +To perform linting and formatting buf is required, see https://buf.build/. + ## Contributing Feel free to contribute to this project after reading the [contributing diff --git a/accounting/service.proto b/accounting/service.proto index 50bcc57..3b94884 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -2,13 +2,13 @@ syntax = "proto3"; package neo.fs.v2.accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc;accounting"; -option csharp_namespace = "Neo.FileStorage.API.Accounting"; - import "accounting/types.proto"; import "refs/types.proto"; import "session/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Accounting"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc;accounting"; + // Accounting service provides methods for interaction with FS chain via // other NeoFS nodes to get information about the account balance. Deposit and // Withdraw operations can't be implemented here, as they require Mainnet NeoFS @@ -21,7 +21,7 @@ service AccountingService { // - **OK** (0, SECTION_SUCCESS): // balance has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). - rpc Balance (BalanceRequest) returns (BalanceResponse); + rpc Balance(BalanceRequest) returns (BalanceResponse); } // BalanceRequest message diff --git a/accounting/types.proto b/accounting/types.proto index f1facbf..0044e11 100644 --- a/accounting/types.proto +++ b/accounting/types.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package neo.fs.v2.accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc;accounting"; option csharp_namespace = "Neo.FileStorage.API.Accounting"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc;accounting"; // Standard floating point data type can't be used in NeoFS due to inexactness // of the result when doing lots of small number operations. To solve the lost diff --git a/acl/types.proto b/acl/types.proto index fa55427..2503f48 100644 --- a/acl/types.proto +++ b/acl/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.acl; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc;acl"; -option csharp_namespace = "Neo.FileStorage.API.Acl"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Acl"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc;acl"; + // Target role of the access control rule in access control list. enum Role { // Unspecified role, default value @@ -161,27 +161,27 @@ message EACLRecord { MatchType match_type = 2 [json_name = "matchType"]; // Name of the Header to use - string key = 3 [json_name="key"]; + string key = 3 [json_name = "key"]; // Expected Header Value or pattern to match - string value = 4 [json_name="value"]; + string value = 4 [json_name = "value"]; } // List of filters to match and see if rule is applicable - repeated Filter filters = 3 [json_name="filters"]; + repeated Filter filters = 3 [json_name = "filters"]; // Target to apply ACL rule. Can be a subject's role class or a list of public // keys to match. message Target { // Target subject's role class - Role role = 1 [json_name="role"]; + Role role = 1 [json_name = "role"]; // List of 25-byte accounts to identify target subjects. // 33-byte public keys are also supported, however, they are deprecated and script hashes should be derived from them. - repeated bytes keys = 2 [json_name="keys"]; + repeated bytes keys = 2 [json_name = "keys"]; } // List of target subjects to apply ACL rule to - repeated Target targets = 4 [json_name="targets"]; + repeated Target targets = 4 [json_name = "targets"]; } // Extended ACL rules table. A list of ACL rules defined additionally to Basic @@ -194,10 +194,10 @@ message EACLTable { neo.fs.v2.refs.Version version = 1 [json_name = "version"]; // Identifier of the container that should use given access control rules - neo.fs.v2.refs.ContainerID container_id = 2 [json_name="containerID"]; + neo.fs.v2.refs.ContainerID container_id = 2 [json_name = "containerID"]; // List of Extended ACL rules - repeated EACLRecord records = 3 [json_name="records"]; + repeated EACLRecord records = 3 [json_name = "records"]; } // BearerToken allows to attach signed Extended ACL rules to the request in @@ -217,34 +217,34 @@ message BearerToken { // container. If it contains `container_id` field, bearer token is only // valid for this specific container. Otherwise, any container of the same owner // is allowed. - EACLTable eacl_table = 1 [json_name="eaclTable"]; + EACLTable eacl_table = 1 [json_name = "eaclTable"]; // `OwnerID` defines to whom the token was issued. It must match the request // originator's `OwnerID`. If empty, any token bearer will be accepted. - neo.fs.v2.refs.OwnerID owner_id = 2 [json_name="ownerID"]; + neo.fs.v2.refs.OwnerID owner_id = 2 [json_name = "ownerID"]; // Lifetime parameters of the token. Field names taken from // [rfc7519](https://tools.ietf.org/html/rfc7519). message TokenLifetime { // Expiration Epoch - uint64 exp = 1 [json_name="exp"]; + uint64 exp = 1 [json_name = "exp"]; // Not valid before Epoch - uint64 nbf = 2 [json_name="nbf"]; + uint64 nbf = 2 [json_name = "nbf"]; // Issued at Epoch - uint64 iat = 3 [json_name="iat"]; + uint64 iat = 3 [json_name = "iat"]; } // Token expiration and valid time period parameters - TokenLifetime lifetime = 3 [json_name="lifetime"]; + TokenLifetime lifetime = 3 [json_name = "lifetime"]; // Token issuer's user ID in NeoFS. It must equal to the related // container's owner. - neo.fs.v2.refs.OwnerID issuer = 4 [json_name="issuer"]; + neo.fs.v2.refs.OwnerID issuer = 4 [json_name = "issuer"]; } // Bearer Token body - Body body = 1 [json_name="body"]; + Body body = 1 [json_name = "body"]; // Signature of BearerToken body - neo.fs.v2.refs.Signature signature = 2 [json_name="signature"]; + neo.fs.v2.refs.Signature signature = 2 [json_name = "signature"]; } diff --git a/audit/types.proto b/audit/types.proto index 8a9bb72..356568d 100644 --- a/audit/types.proto +++ b/audit/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.audit; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc;audit"; -option csharp_namespace = "Neo.FileStorage.API.Audit"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Audit"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/audit/grpc;audit"; + // DataAuditResult keeps record of conducted Data Audits. The detailed report is // generated separately. message DataAuditResult { diff --git a/container/service.proto b/container/service.proto index 25f6d5d..9063fa3 100644 --- a/container/service.proto +++ b/container/service.proto @@ -2,14 +2,14 @@ syntax = "proto3"; package neo.fs.v2.container; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container/grpc;container"; -option csharp_namespace = "Neo.FileStorage.API.Container"; - import "acl/types.proto"; import "container/types.proto"; import "refs/types.proto"; import "session/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Container"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container/grpc;container"; + // `ContainerService` provides API to interact with `Container` smart contract // in FS chain via other NeoFS nodes. All of those actions can be done // equivalently by directly issuing transactions and RPC calls to FS chain @@ -301,7 +301,7 @@ message SetExtendedACLResponse { // `SetExtendedACLResponse` has an empty body because the operation is // asynchronous and the update should be reflected in `Container` smart contract's // storage after next block is issued in FS chain. - message Body { } + message Body {} // Body of set extended acl response message. Body body = 1; @@ -404,7 +404,7 @@ message AnnounceUsedSpaceRequest { message AnnounceUsedSpaceResponse { // `AnnounceUsedSpaceResponse` has an empty body because announcements are // one way communication. - message Body { } + message Body {} // Body of announce used space response message. Body body = 1; diff --git a/container/types.proto b/container/types.proto index 6af7b31..9c32b59 100644 --- a/container/types.proto +++ b/container/types.proto @@ -2,12 +2,12 @@ syntax = "proto3"; package neo.fs.v2.container; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container/grpc;container"; -option csharp_namespace = "Neo.FileStorage.API.Container"; - import "netmap/types.proto"; import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Container"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container/grpc;container"; + // Container is a structure that defines object placement behaviour. Objects can // be stored only within containers. They define placement rule, attributes and // access control information. An ID of a container is a 32 byte long SHA256 hash diff --git a/link/types.proto b/link/types.proto index b7d78b5..62276c1 100644 --- a/link/types.proto +++ b/link/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.link; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/link/grpc;link"; -option csharp_namespace = "Neo.FileStorage.API.Link"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Link"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/link/grpc;link"; + // Link is a payload of helper objects that contain the full list of the split // chain objects' IDs. It is created only after the whole split chain is known // and signed. This object is the only object that refers to every "child object" diff --git a/lock/types.proto b/lock/types.proto index ae0cdc1..3e1e917 100644 --- a/lock/types.proto +++ b/lock/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.lock; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/lock/grpc;lock"; -option csharp_namespace = "Neo.FileStorage.API.Lock"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Lock"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/lock/grpc;lock"; + // Lock objects protects a list of objects from being deleted. The lifetime of a // lock object is limited similar to regular objects in // `__NEOFS__EXPIRATION_EPOCH` attribute. Lock object MUST have expiration epoch. diff --git a/netmap/service.proto b/netmap/service.proto index 09e8751..184179f 100644 --- a/netmap/service.proto +++ b/netmap/service.proto @@ -2,19 +2,19 @@ syntax = "proto3"; package neo.fs.v2.netmap; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc;netmap"; -option csharp_namespace = "Neo.FileStorage.API.Netmap"; - import "netmap/types.proto"; import "refs/types.proto"; import "session/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Netmap"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc;netmap"; + // `NetmapService` provides methods to work with `Network Map` and the information // required to build it. The resulting `Network Map` is stored in FS chain // `Netmap` smart contract, while related information can be obtained from other // NeoFS nodes. service NetmapService { - // Get NodeInfo structure from the particular node directly. + // Get NodeInfo structure from the particular node directly. // Node information can be taken from `Netmap` smart contract. In some cases, though, // one may want to get recent information directly or to talk to the node not yet // present in the `Network Map` to find out what API version can be used for @@ -24,7 +24,7 @@ service NetmapService { // - **OK** (0, SECTION_SUCCESS): // information about the server has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). - rpc LocalNodeInfo (LocalNodeInfoRequest) returns (LocalNodeInfoResponse); + rpc LocalNodeInfo(LocalNodeInfoRequest) returns (LocalNodeInfoResponse); // Read recent information about the NeoFS network. // @@ -32,7 +32,7 @@ service NetmapService { // - **OK** (0, SECTION_SUCCESS): // information about the current network state has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). - rpc NetworkInfo (NetworkInfoRequest) returns (NetworkInfoResponse); + rpc NetworkInfo(NetworkInfoRequest) returns (NetworkInfoResponse); // Returns network map snapshot of the current NeoFS epoch. // @@ -40,14 +40,13 @@ service NetmapService { // - **OK** (0, SECTION_SUCCESS): // information about the current network map has been successfully read; // - Common failures (SECTION_FAILURE_COMMON). - rpc NetmapSnapshot (NetmapSnapshotRequest) returns (NetmapSnapshotResponse); + rpc NetmapSnapshot(NetmapSnapshotRequest) returns (NetmapSnapshotResponse); } // Get NodeInfo structure directly from a particular node message LocalNodeInfoRequest { // LocalNodeInfo request body is empty. - message Body { - } + message Body {} // Body of the LocalNodeInfo request message Body body = 1; @@ -86,81 +85,77 @@ message LocalNodeInfoResponse { // Get NetworkInfo structure with the network view from a particular node. message NetworkInfoRequest { - // NetworkInfo request body is empty. - message Body { - } - // Body of the NetworkInfo request message - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.session.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. - neo.fs.v2.session.RequestVerificationHeader verify_header = 3; + // NetworkInfo request body is empty. + message Body {} + // Body of the NetworkInfo request message + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + neo.fs.v2.session.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. + neo.fs.v2.session.RequestVerificationHeader verify_header = 3; } // Response with NetworkInfo structure including current epoch and // FS chain magic number. message NetworkInfoResponse { - // Information about the network. - message Body { - // NetworkInfo structure with recent information. - NetworkInfo network_info = 1; - } - // Body of the NetworkInfo response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect response execution. - neo.fs.v2.session.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. - neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; + // Information about the network. + message Body { + // NetworkInfo structure with recent information. + NetworkInfo network_info = 1; + } + // Body of the NetworkInfo response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + neo.fs.v2.session.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. + neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; } // Get netmap snapshot request message NetmapSnapshotRequest { - // Get netmap snapshot request body. - message Body { - } - - // Body of get netmap snapshot request message. - Body body = 1; + // Get netmap snapshot request body. + message Body {} - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.session.RequestMetaHeader meta_header = 2; + // Body of get netmap snapshot request message. + Body body = 1; - // Carries request verification information. This header is used to - // authenticate the nodes of the message route and check the correctness of - // transmission. - neo.fs.v2.session.RequestVerificationHeader verify_header = 3; + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + neo.fs.v2.session.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. + neo.fs.v2.session.RequestVerificationHeader verify_header = 3; } // Response with current netmap snapshot message NetmapSnapshotResponse { - // Get netmap snapshot response body - message Body { - // Structure of the requested network map. - Netmap netmap = 1 [json_name = "netmap"]; - } - - // Body of get netmap snapshot response message. - Body body = 1; + // Get netmap snapshot response body + message Body { + // Structure of the requested network map. + Netmap netmap = 1 [json_name = "netmap"]; + } - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect response execution. - neo.fs.v2.session.ResponseMetaHeader meta_header = 2; + // Body of get netmap snapshot response message. + Body body = 1; - // Carries response verification information. This header is used to - // authenticate the nodes of the message route and check the correctness of - // transmission. - neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + neo.fs.v2.session.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. + neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; } diff --git a/netmap/types.proto b/netmap/types.proto index a581099..bad932d 100644 --- a/netmap/types.proto +++ b/netmap/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.netmap; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc;netmap"; -option csharp_namespace = "Neo.FileStorage.API.Netmap"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Netmap"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc;netmap"; + // Operations on filters enum Operation { // No Operation defined @@ -124,7 +124,10 @@ message PlacementPolicy { // DEPRECATED. Was used for subnetwork ID to select nodes from, currently // ignored. - refs.SubnetID subnet_id = 5 [json_name = "subnetId", deprecated = true]; + refs.SubnetID subnet_id = 5 [ + json_name = "subnetId", + deprecated = true + ]; } // NeoFS node description @@ -257,11 +260,11 @@ message NodeInfo { // Network map structure message Netmap { - // Network map revision number. - uint64 epoch = 1 [json_name = "epoch"]; + // Network map revision number. + uint64 epoch = 1 [json_name = "epoch"]; - // Nodes presented in network. - repeated NodeInfo nodes = 2 [json_name = "nodes"]; + // Nodes presented in network. + repeated NodeInfo nodes = 2 [json_name = "nodes"]; } // NeoFS network configuration @@ -320,15 +323,15 @@ message NetworkConfig { // Information about NeoFS network message NetworkInfo { - // Number of the current epoch in the NeoFS network - uint64 current_epoch = 1 [json_name = "currentEpoch"]; + // Number of the current epoch in the NeoFS network + uint64 current_epoch = 1 [json_name = "currentEpoch"]; - // Magic number of FS chain of the NeoFS network - uint64 magic_number = 2 [json_name = "magicNumber"]; + // Magic number of FS chain of the NeoFS network + uint64 magic_number = 2 [json_name = "magicNumber"]; - // MillisecondsPerBlock network parameter of FS chain of the NeoFS network - int64 ms_per_block = 3 [json_name = "msPerBlock"]; + // MillisecondsPerBlock network parameter of FS chain of the NeoFS network + int64 ms_per_block = 3 [json_name = "msPerBlock"]; - // NeoFS network configuration - NetworkConfig network_config = 4 [json_name = "networkConfig"]; + // NeoFS network configuration + NetworkConfig network_config = 4 [json_name = "networkConfig"]; } diff --git a/object/service.proto b/object/service.proto index 0b5ddce..ff2fa56 100644 --- a/object/service.proto +++ b/object/service.proto @@ -2,14 +2,14 @@ syntax = "proto3"; package neo.fs.v2.object; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object/grpc;object"; -option csharp_namespace = "Neo.FileStorage.API.Object"; - import "object/types.proto"; import "refs/types.proto"; import "session/types.proto"; import "status/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Object"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object/grpc;object"; + // `ObjectService` provides API for manipulating objects. Object operations do // not affect FS chain and are only served by nodes in P2P style. service ObjectService { @@ -384,7 +384,7 @@ message DeleteRequest { message Body { // Address of the object to be deleted neo.fs.v2.refs.Address address = 1; - } + } // Body of delete object request message. Body body = 1; @@ -468,7 +468,7 @@ message HeadResponse { message Body { // Requested object header, it's part or meta information about split // object. - oneof head{ + oneof head { // Full object's `Header` with `ObjectID` signature HeaderWithSignature header = 1; @@ -658,7 +658,7 @@ message GetRangeResponse { // chunks. message Body { // Requested object range or meta information about split object. - oneof range_part{ + oneof range_part { // Chunked object payload's range. bytes chunk = 1; diff --git a/object/types.proto b/object/types.proto index ecb1de6..1a4371c 100644 --- a/object/types.proto +++ b/object/types.proto @@ -2,12 +2,12 @@ syntax = "proto3"; package neo.fs.v2.object; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object/grpc;object"; -option csharp_namespace = "Neo.FileStorage.API.Object"; - import "refs/types.proto"; import "session/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Object"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object/grpc;object"; + // Type of the object payload content. Only `REGULAR` type objects can be split, // hence `TOMBSTONE`, `STORAGE_GROUP` and `LOCK` payload is limited by the maximum // object size. diff --git a/refs/types.proto b/refs/types.proto index 70c941b..b3dce60 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package neo.fs.v2.refs; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc;refs"; option csharp_namespace = "Neo.FileStorage.API.Refs"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc;refs"; // Objects in NeoFS are addressed by their ContainerID and ObjectID. // diff --git a/reputation/service.proto b/reputation/service.proto index c430c5e..a799bb0 100644 --- a/reputation/service.proto +++ b/reputation/service.proto @@ -2,127 +2,125 @@ syntax = "proto3"; package neo.fs.v2.reputation; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc;reputation"; -option csharp_namespace = "Neo.FileStorage.API.Reputation"; - import "reputation/types.proto"; import "session/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Reputation"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc;reputation"; + // `ReputationService` provides mechanisms for exchanging trust values with // other NeoFS nodes. Nodes rate each other's reputation based on how good they // process requests and set a trust level based on that rating. The trust // information is passed to the next nodes to check and aggregate unless the // final result is recorded. service ReputationService { - // Announce local client trust information to any node in NeoFS network. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // local trust has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - rpc AnnounceLocalTrust (AnnounceLocalTrustRequest) returns (AnnounceLocalTrustResponse); - - // Announce the intermediate result of the iterative algorithm for - // calculating the global reputation of the node in NeoFS network. - // - // Statuses: - // - **OK** (0, SECTION_SUCCESS): - // intermediate trust estimation has been successfully announced; - // - Common failures (SECTION_FAILURE_COMMON). - rpc AnnounceIntermediateResult (AnnounceIntermediateResultRequest) returns (AnnounceIntermediateResultResponse); + // Announce local client trust information to any node in NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // local trust has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). + rpc AnnounceLocalTrust(AnnounceLocalTrustRequest) returns (AnnounceLocalTrustResponse); + + // Announce the intermediate result of the iterative algorithm for + // calculating the global reputation of the node in NeoFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // intermediate trust estimation has been successfully announced; + // - Common failures (SECTION_FAILURE_COMMON). + rpc AnnounceIntermediateResult(AnnounceIntermediateResultRequest) returns (AnnounceIntermediateResultResponse); } // Announce node's local trust information. message AnnounceLocalTrustRequest { - // Announce node's local trust information. - message Body { - // Trust assessment Epoch number - uint64 epoch = 1; - - // List of normalized local trust values to other NeoFS nodes. The value - // is calculated according to EigenTrust++ algorithm and must be a - // floating point number in [0;1] range. - repeated Trust trusts = 2; - } - - // Body of the request message. - Body body = 1; - - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.session.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. - neo.fs.v2.session.RequestVerificationHeader verify_header = 3; + // Announce node's local trust information. + message Body { + // Trust assessment Epoch number + uint64 epoch = 1; + + // List of normalized local trust values to other NeoFS nodes. The value + // is calculated according to EigenTrust++ algorithm and must be a + // floating point number in [0;1] range. + repeated Trust trusts = 2; + } + + // Body of the request message. + Body body = 1; + + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + neo.fs.v2.session.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. + neo.fs.v2.session.RequestVerificationHeader verify_header = 3; } // Node's local trust information announcement response. message AnnounceLocalTrustResponse { - // Response to the node's local trust information announcement has an empty body - // because the trust exchange operation is asynchronous. If Trust information - // does not pass sanity checks, it is silently ignored. - message Body { - } - - // Body of the response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.session.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. - neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; + // Response to the node's local trust information announcement has an empty body + // because the trust exchange operation is asynchronous. If Trust information + // does not pass sanity checks, it is silently ignored. + message Body {} + + // Body of the response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + neo.fs.v2.session.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. + neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; } // Announce intermediate global trust information. message AnnounceIntermediateResultRequest { - // Announce intermediate global trust information. - message Body { - // Iteration execution Epoch number - uint64 epoch = 1; + // Announce intermediate global trust information. + message Body { + // Iteration execution Epoch number + uint64 epoch = 1; - // Iteration sequence number - uint32 iteration = 2; + // Iteration sequence number + uint32 iteration = 2; - // Current global trust value calculated at the specified iteration - PeerToPeerTrust trust = 3; - } + // Current global trust value calculated at the specified iteration + PeerToPeerTrust trust = 3; + } - // Body of the request message. - Body body = 1; + // Body of the request message. + Body body = 1; - // Carries request meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.session.RequestMetaHeader meta_header = 2; + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + neo.fs.v2.session.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. - neo.fs.v2.session.RequestVerificationHeader verify_header = 3; + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + neo.fs.v2.session.RequestVerificationHeader verify_header = 3; } // Intermediate global trust information announcement response. message AnnounceIntermediateResultResponse { - // Response to the node's intermediate global trust information announcement has - // an empty body because the trust exchange operation is asynchronous. If - // Trust information does not pass sanity checks, it is silently ignored. - message Body { - } - - // Body of the response message. - Body body = 1; - - // Carries response meta information. Header data is used only to regulate - // message transport and does not affect request execution. - neo.fs.v2.session.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. - neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; + // Response to the node's intermediate global trust information announcement has + // an empty body because the trust exchange operation is asynchronous. If + // Trust information does not pass sanity checks, it is silently ignored. + message Body {} + + // Body of the response message. + Body body = 1; + + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + neo.fs.v2.session.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. + neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; } diff --git a/reputation/types.proto b/reputation/types.proto index 627008d..3c6b7ff 100644 --- a/reputation/types.proto +++ b/reputation/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.reputation; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc;reputation"; -option csharp_namespace = "Neo.FileStorage.API.Reputation"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Reputation"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc;reputation"; + // NeoFS unique peer identifier is a 33 byte long compressed public key of the // node, the same as the one stored in the network map. // @@ -19,45 +19,45 @@ import "refs/types.proto"; // [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding // with/without paddings are accepted. message PeerID { - // Peer node's public key - bytes public_key = 1 [json_name = "publicKey"]; + // Peer node's public key + bytes public_key = 1 [json_name = "publicKey"]; } // Trust level to a NeoFS network peer. message Trust { - // Identifier of the trusted peer - PeerID peer = 1 [json_name = "peer"]; + // Identifier of the trusted peer + PeerID peer = 1 [json_name = "peer"]; - // Trust level in [0:1] range - double value = 2 [json_name = "value"]; + // Trust level in [0:1] range + double value = 2 [json_name = "value"]; } // Trust level of a peer to a peer. message PeerToPeerTrust { - // Identifier of the trusting peer - PeerID trusting_peer = 1 [json_name = "trustingPeer"]; + // Identifier of the trusting peer + PeerID trusting_peer = 1 [json_name = "trustingPeer"]; - // Trust level - Trust trust = 2 [json_name = "trust"]; + // Trust level + Trust trust = 2 [json_name = "trust"]; } // Global trust level to NeoFS node. message GlobalTrust { - // Message format version. Effectively, the version of API library used to create - // the message. - neo.fs.v2.refs.Version version = 1 [json_name = "version"]; - // Message body structure. - message Body { - // Node manager ID - PeerID manager = 1 [json_name = "manager"]; - - // Global trust level - Trust trust = 2 [json_name = "trust"]; - } - - // Message body - Body body = 2 [json_name = "body"]; - - // Signature of the binary `body` field by the manager. - neo.fs.v2.refs.Signature signature = 3 [json_name = "signature"]; + // Message format version. Effectively, the version of API library used to create + // the message. + neo.fs.v2.refs.Version version = 1 [json_name = "version"]; + // Message body structure. + message Body { + // Node manager ID + PeerID manager = 1 [json_name = "manager"]; + + // Global trust level + Trust trust = 2 [json_name = "trust"]; + } + + // Message body + Body body = 2 [json_name = "body"]; + + // Signature of the binary `body` field by the manager. + neo.fs.v2.refs.Signature signature = 3 [json_name = "signature"]; } diff --git a/session/service.proto b/session/service.proto index 98c2ca4..4b04482 100644 --- a/session/service.proto +++ b/session/service.proto @@ -2,12 +2,12 @@ syntax = "proto3"; package neo.fs.v2.session; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session/grpc;session"; -option csharp_namespace = "Neo.FileStorage.API.Session"; - import "refs/types.proto"; import "session/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Session"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session/grpc;session"; + // `SessionService` allows to establish a temporary trust relationship between // two peer nodes and generate a `SessionToken` as the proof of trust to be // attached in requests for further verification. Please see corresponding @@ -19,7 +19,7 @@ service SessionService { // - **OK** (0, SECTION_SUCCESS): // session has been successfully opened; // - Common failures (SECTION_FAILURE_COMMON). - rpc Create (CreateRequest) returns (CreateResponse); + rpc Create(CreateRequest) returns (CreateResponse); } // Information necessary for opening a session. diff --git a/session/types.proto b/session/types.proto index ec17432..9d72f9c 100644 --- a/session/types.proto +++ b/session/types.proto @@ -2,13 +2,13 @@ syntax = "proto3"; package neo.fs.v2.session; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session/grpc;session"; -option csharp_namespace = "Neo.FileStorage.API.Session"; - -import "refs/types.proto"; import "acl/types.proto"; +import "refs/types.proto"; import "status/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Session"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session/grpc;session"; + // Context information for Session Tokens related to ObjectService requests message ObjectSessionContext { // Object request verbs @@ -59,30 +59,30 @@ message ObjectSessionContext { // Context information for Session Tokens related to ContainerService requests. message ContainerSessionContext { - // Container request verbs - enum Verb { - // Unknown verb - VERB_UNSPECIFIED = 0; + // Container request verbs + enum Verb { + // Unknown verb + VERB_UNSPECIFIED = 0; - // Refers to container.Put RPC call - PUT = 1; + // Refers to container.Put RPC call + PUT = 1; - // Refers to container.Delete RPC call - DELETE = 2; + // Refers to container.Delete RPC call + DELETE = 2; - // Refers to container.SetExtendedACL RPC call - SETEACL = 3; - } - // Type of request for which the token is issued - Verb verb = 1 [json_name = "verb"]; + // Refers to container.SetExtendedACL RPC call + SETEACL = 3; + } + // Type of request for which the token is issued + Verb verb = 1 [json_name = "verb"]; - // Spreads the action to all owner containers. - // If set, container_id field is ignored. - bool wildcard = 2 [json_name = "wildcard"]; + // Spreads the action to all owner containers. + // If set, container_id field is ignored. + bool wildcard = 2 [json_name = "wildcard"]; - // Particular container to which the action applies. - // Ignored if wildcard flag is set. - refs.ContainerID container_id = 3 [json_name = "containerID"]; + // Particular container to which the action applies. + // Ignored if wildcard flag is set. + refs.ContainerID container_id = 3 [json_name = "containerID"]; } // NeoFS Session Token. diff --git a/status/types.proto b/status/types.proto index 1b4a9fc..367452a 100644 --- a/status/types.proto +++ b/status/types.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package neo.fs.v2.status; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/status/grpc;status"; option csharp_namespace = "Neo.FileStorage.API.Status"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/status/grpc;status"; // Declares the general format of the status returns of the NeoFS RPC protocol. // Status is present in all response messages. Each RPC of NeoFS protocol @@ -33,113 +33,113 @@ option csharp_namespace = "Neo.FileStorage.API.Status"; // should not expect) useful information in the message. Field `details` // should make the return more detailed. message Status { - // The status code - uint32 code = 1; - - // Developer-facing error message - string message = 2; - - // Return detail. It contains additional information that can be used to - // analyze the response. Each code defines a set of details that can be - // attached to a status. Client should not handle details that are not - // covered by the code. - message Detail { - // Detail ID. The identifier is required to determine the binary format - // of the detail and how to decode it. - uint32 id = 1; - - // Binary status detail. Must follow the format associated with ID. - // The possibility of missing a value must be explicitly allowed. - bytes value = 2; - } - - // Data detailing the outcome of the operation. Must be unique by ID. - repeated Detail details = 3; + // The status code + uint32 code = 1; + + // Developer-facing error message + string message = 2; + + // Return detail. It contains additional information that can be used to + // analyze the response. Each code defines a set of details that can be + // attached to a status. Client should not handle details that are not + // covered by the code. + message Detail { + // Detail ID. The identifier is required to determine the binary format + // of the detail and how to decode it. + uint32 id = 1; + + // Binary status detail. Must follow the format associated with ID. + // The possibility of missing a value must be explicitly allowed. + bytes value = 2; + } + + // Data detailing the outcome of the operation. Must be unique by ID. + repeated Detail details = 3; } // Section identifiers. enum Section { - // Successful return codes. - SECTION_SUCCESS = 0; + // Successful return codes. + SECTION_SUCCESS = 0; - // Failure codes regardless of the operation. - SECTION_FAILURE_COMMON = 1; + // Failure codes regardless of the operation. + SECTION_FAILURE_COMMON = 1; - // Object service-specific errors. - SECTION_OBJECT = 2; + // Object service-specific errors. + SECTION_OBJECT = 2; - // Container service-specific errors. - SECTION_CONTAINER = 3; + // Container service-specific errors. + SECTION_CONTAINER = 3; - // Session service-specific errors. - SECTION_SESSION = 4; + // Session service-specific errors. + SECTION_SESSION = 4; } // Section of NeoFS successful return codes. enum Success { - // [**0**] Default success. Not detailed. - // If the server cannot match successful outcome to the code, it should - // use this code. - OK = 0; + // [**0**] Default success. Not detailed. + // If the server cannot match successful outcome to the code, it should + // use this code. + OK = 0; } // Section of failed statuses independent of the operation. enum CommonFail { - // [**1024**] Internal server error, default failure. Not detailed. - // If the server cannot match failed outcome to the code, it should - // use this code. - INTERNAL = 0; - - // [**1025**] Wrong magic of the NeoFS network. - // Details: - // - [**0**] Magic number of the served NeoFS network (big-endian 64-bit - // unsigned integer). - WRONG_MAGIC_NUMBER = 1; - - // [**1026**] Signature verification failure. - SIGNATURE_VERIFICATION_FAIL = 2; - - // [**1027**] Node is under maintenance. - NODE_UNDER_MAINTENANCE = 3; + // [**1024**] Internal server error, default failure. Not detailed. + // If the server cannot match failed outcome to the code, it should + // use this code. + INTERNAL = 0; + + // [**1025**] Wrong magic of the NeoFS network. + // Details: + // - [**0**] Magic number of the served NeoFS network (big-endian 64-bit + // unsigned integer). + WRONG_MAGIC_NUMBER = 1; + + // [**1026**] Signature verification failure. + SIGNATURE_VERIFICATION_FAIL = 2; + + // [**1027**] Node is under maintenance. + NODE_UNDER_MAINTENANCE = 3; } // Section of statuses for object-related operations. enum Object { - // [**2048**] Access denied by ACL. - // Details: - // - [**0**] Human-readable description (UTF-8 encoded string). - ACCESS_DENIED = 0; + // [**2048**] Access denied by ACL. + // Details: + // - [**0**] Human-readable description (UTF-8 encoded string). + ACCESS_DENIED = 0; - // [**2049**] Object not found. - OBJECT_NOT_FOUND = 1; + // [**2049**] Object not found. + OBJECT_NOT_FOUND = 1; - // [**2050**] Operation rejected by the object lock. - LOCKED = 2; + // [**2050**] Operation rejected by the object lock. + LOCKED = 2; - // [**2051**] Locking an object with a non-REGULAR type rejected. - LOCK_NON_REGULAR_OBJECT = 3; + // [**2051**] Locking an object with a non-REGULAR type rejected. + LOCK_NON_REGULAR_OBJECT = 3; - // [**2052**] Object has been marked deleted. - OBJECT_ALREADY_REMOVED = 4; + // [**2052**] Object has been marked deleted. + OBJECT_ALREADY_REMOVED = 4; - // [**2053**] Invalid range has been requested for an object. - OUT_OF_RANGE = 5; + // [**2053**] Invalid range has been requested for an object. + OUT_OF_RANGE = 5; } // Section of statuses for container-related operations. enum Container { - // [**3072**] Container not found. - CONTAINER_NOT_FOUND = 0; + // [**3072**] Container not found. + CONTAINER_NOT_FOUND = 0; - // [**3073**] eACL table not found. - EACL_NOT_FOUND = 1; + // [**3073**] eACL table not found. + EACL_NOT_FOUND = 1; } // Section of statuses for session-related operations. enum Session { - // [**4096**] Token not found. - TOKEN_NOT_FOUND = 0; + // [**4096**] Token not found. + TOKEN_NOT_FOUND = 0; - // [**4097**] Token has expired. - TOKEN_EXPIRED = 1; + // [**4097**] Token has expired. + TOKEN_EXPIRED = 1; } diff --git a/storagegroup/types.proto b/storagegroup/types.proto index c54c741..2a21142 100644 --- a/storagegroup/types.proto +++ b/storagegroup/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.storagegroup; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc;storagegroup"; -option csharp_namespace = "Neo.FileStorage.API.StorageGroup"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.StorageGroup"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc;storagegroup"; + // StorageGroup keeps verification information for Data Audit sessions. Objects // that require paid storage guarantees are gathered in `StorageGroups` with // additional information used for the proof of storage. `StorageGroup` only @@ -27,7 +27,10 @@ message StorageGroup { neo.fs.v2.refs.Checksum validation_hash = 2 [json_name = "validationHash"]; // DEPRECATED. Last NeoFS epoch number of the storage group lifetime - uint64 expiration_epoch = 3 [json_name = "expirationEpoch", deprecated = true]; + uint64 expiration_epoch = 3 [ + json_name = "expirationEpoch", + deprecated = true + ]; // Strictly ordered list of storage group member objects. Members MUST be unique repeated neo.fs.v2.refs.ObjectID members = 4 [json_name = "members"]; diff --git a/subnet/types.proto b/subnet/types.proto index b2c5571..e8bbd14 100644 --- a/subnet/types.proto +++ b/subnet/types.proto @@ -2,19 +2,19 @@ syntax = "proto3"; package neo.fs.v2.subnet; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/subnet/grpc;subnet"; -option csharp_namespace = "Neo.FileStorage.API.Subnet"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Subnet"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/subnet/grpc;subnet"; + // NeoFS subnetwork description // // DEPRECATED. Ignored and kept for compatibility only. message SubnetInfo { - // Unique subnet identifier. Missing ID is - // equivalent to zero (default subnetwork) ID. - neo.fs.v2.refs.SubnetID id = 1; + // Unique subnet identifier. Missing ID is + // equivalent to zero (default subnetwork) ID. + neo.fs.v2.refs.SubnetID id = 1; - // Identifier of the subnetwork owner - neo.fs.v2.refs.OwnerID owner = 2; + // Identifier of the subnetwork owner + neo.fs.v2.refs.OwnerID owner = 2; } diff --git a/tombstone/types.proto b/tombstone/types.proto index 8a67ae5..c7731a1 100644 --- a/tombstone/types.proto +++ b/tombstone/types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package neo.fs.v2.tombstone; -option go_package = "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc;tombstone"; -option csharp_namespace = "Neo.FileStorage.API.Tombstone"; - import "refs/types.proto"; +option csharp_namespace = "Neo.FileStorage.API.Tombstone"; +option go_package = "github.com/nspcc-dev/neofs-api-go/v2/tombstone/grpc;tombstone"; + // Tombstone keeps record of deleted objects for a few epochs until they are // purged from the NeoFS network. message Tombstone { @@ -14,7 +14,10 @@ message Tombstone { // creator depending on the current NeoFS network settings. // DEPRECATED. Field ignored by servers, set corresponding object attribute // `__NEOFS__EXPIRATION_EPOCH` only. - uint64 expiration_epoch = 1 [json_name = "expirationEpoch", deprecated = true]; + uint64 expiration_epoch = 1 [ + json_name = "expirationEpoch", + deprecated = true + ]; // 16 byte UUID used to identify the split object hierarchy parts. Must be // unique inside a container. All objects participating in the split must