From 40420f3ab0da9d5f64592c1c5746aa5cd700adf5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 5 Aug 2020 19:49:16 +0300 Subject: [PATCH] [#31] refs: Use OwnerID message in all services Change the type of all fields for identifier of the container owner to refs.OwnerID. This will allow you to follow a single format and not duplicate its description. Signed-off-by: Leonard Lyubich --- accounting/service.proto | 5 +++-- container/service.proto | 4 ++-- container/types.proto | 5 +++-- object/service.proto | 4 ++-- object/types.proto | 4 ++-- proto-docs/accounting.md | 2 +- proto-docs/container.md | 4 ++-- proto-docs/object.md | 4 ++-- proto-docs/service.md | 4 ++-- proto-docs/session.md | 2 +- service/verify.proto | 8 ++++---- session/service.proto | 5 +++-- 12 files changed, 27 insertions(+), 24 deletions(-) diff --git a/accounting/service.proto b/accounting/service.proto index d1540c4..f381605 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -7,6 +7,7 @@ import "service/meta.proto"; import "service/verify.proto"; import "decimal/decimal.proto"; import "accounting/types.proto"; +import "refs/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -19,8 +20,8 @@ service Accounting { } message BalanceRequest { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // OwnerID carries user identifier in NeoFS system. + refs.OwnerID OwnerID = 1; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) diff --git a/container/service.proto b/container/service.proto index 28fdd3b..5f01591 100644 --- a/container/service.proto +++ b/container/service.proto @@ -80,8 +80,8 @@ message GetResponse { } message ListRequest { - // OwnerID is a 25 byte NEO3.0 wallet address. - bytes OwnerID = 1; + // OwnerID carries identifier of the container owner. + refs.OwnerID OwnerID = 1; } message ListResponse { diff --git a/container/types.proto b/container/types.proto index 9eaf2c0..d3cc147 100644 --- a/container/types.proto +++ b/container/types.proto @@ -3,6 +3,7 @@ package container; option go_package = "github.com/nspcc-dev/neofs-api-go/container"; option csharp_namespace = "NeoFS.API.Container"; +import "refs/types.proto"; import "github.com/nspcc-dev/netmap/selector.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -13,8 +14,8 @@ option (gogoproto.stable_marshaler_all) = true; // and access control information. ID of the container is a 32 byte long // SHA256 hash of stable-marshalled container message. message Container { - // OwnerID is a 25 byte NEO3.0 wallet address. - bytes OwnerID = 1; + // OwnerID carries identifier of the container owner. + refs.OwnerID OwnerID = 1; // Nonce is a 16 byte UUID, used to avoid collisions of container id. bytes Nonce = 2; // BasicACL contains access control rules for owner, system, others groups and diff --git a/object/service.proto b/object/service.proto index 19b78a4..f1b94e6 100644 --- a/object/service.proto +++ b/object/service.proto @@ -105,8 +105,8 @@ message PutResponse { message DeleteRequest { // Address of object (container id + object id) refs.Address Address = 1 [(gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; + // OwnerID carries identifier of the object owner. + refs.OwnerID OwnerID = 2; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) diff --git a/object/types.proto b/object/types.proto index 3bab3b1..8589355 100644 --- a/object/types.proto +++ b/object/types.proto @@ -19,8 +19,8 @@ message Header { // Address carries object address in the NeoFS system. // It encapsulates the object and the container identifiers. refs.Address Address = 2; - // OwnerID carries identifier the object owner in a binary format. - bytes OwnerID = 3; + // OwnerID carries identifier of the object owner. + refs.OwnerID OwnerID = 3; } // Main carries the main part of the header. diff --git a/proto-docs/accounting.md b/proto-docs/accounting.md index bcae136..ce7156b 100644 --- a/proto-docs/accounting.md +++ b/proto-docs/accounting.md @@ -86,7 +86,7 @@ Balance returns current balance status of the NeoFS user | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries user identifier in NeoFS system. | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/proto-docs/container.md b/proto-docs/container.md index 03f9436..1fb70bd 100644 --- a/proto-docs/container.md +++ b/proto-docs/container.md @@ -185,7 +185,7 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a 25 byte NEO3.0 wallet address. | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the container owner. | @@ -279,7 +279,7 @@ SHA256 hash of stable-marshalled container message. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a 25 byte NEO3.0 wallet address. | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the container owner. | | Nonce | [bytes](#bytes) | | Nonce is a 16 byte UUID, used to avoid collisions of container id. | | BasicACL | [uint32](#uint32) | | BasicACL contains access control rules for owner, system, others groups and permission bits for bearer token and Extended ACL. | | Attributes | [Attribute](#container.Attribute) | repeated | Attributes define any immutable characteristics of container. | diff --git a/proto-docs/object.md b/proto-docs/object.md index 03e60e2..9a84732 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -147,7 +147,7 @@ calculated for XORed data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the object owner. | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -458,7 +458,7 @@ Message fields are presented in all NeoFS objects. | ----- | ---- | ----- | ----------- | | PayloadLength | [uint64](#uint64) | | PayloadLength carries length of the object payload. Each object has a fixed payload length since it's immutable. | | Address | [refs.Address](#refs.Address) | | Address carries object address in the NeoFS system. It encapsulates the object and the container identifiers. | -| OwnerID | [bytes](#bytes) | | OwnerID carries identifier the object owner in a binary format. | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the object owner. | diff --git a/proto-docs/service.md b/proto-docs/service.md index 756188b..72043c5 100644 --- a/proto-docs/service.md +++ b/proto-docs/service.md @@ -125,7 +125,7 @@ BearerTokenMsg carries information about request ACL rules with limited lifetime | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | ACLRules | [bytes](#bytes) | | ACLRules carries a binary representation of the table of extended ACL rules | -| OwnerID | [bytes](#bytes) | | OwnerID is an owner of token | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the token owner. | | ValidUntil | [uint64](#uint64) | | ValidUntil carries a last epoch of token lifetime | @@ -176,7 +176,7 @@ User token granting rights for object manipulation | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | ID | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes | -| OwnerID | [bytes](#bytes) | | OwnerID is an owner of manipulation object | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the manipulation object owner. | | verb | [Token.Info.Verb](#service.Token.Info.Verb) | | Verb is a type of request for which the token is issued | | Address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued | | Lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session | diff --git a/proto-docs/session.md b/proto-docs/session.md index 5ec7402..8ce09a0 100644 --- a/proto-docs/session.md +++ b/proto-docs/session.md @@ -52,7 +52,7 @@ CreateRequest carries an information necessary for opening a session | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID carries an identifier of a session initiator | +| OwnerID | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries an identifier of a session initiator. | | Lifetime | [service.TokenLifetime](#service.TokenLifetime) | | Lifetime carries a lifetime of the session | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/service/verify.proto b/service/verify.proto index a7e694f..5206a33 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -34,8 +34,8 @@ message Token { // ID is a token identifier. valid UUIDv4 represented in bytes bytes ID = 1 [(gogoproto.customtype) = "TokenID", (gogoproto.nullable) = false]; - // OwnerID is an owner of manipulation object - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // OwnerID carries identifier of the manipulation object owner. + refs.OwnerID OwnerID = 2; // Verb is an enumeration of session request types enum Verb { @@ -101,8 +101,8 @@ message BearerTokenMsg { // ACLRules carries a binary representation of the table of extended ACL rules bytes ACLRules = 1; - // OwnerID is an owner of token - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // OwnerID carries identifier of the token owner. + refs.OwnerID OwnerID = 2; // ValidUntil carries a last epoch of token lifetime uint64 ValidUntil = 3; diff --git a/session/service.proto b/session/service.proto index b7eb0df..2f50f37 100644 --- a/session/service.proto +++ b/session/service.proto @@ -5,6 +5,7 @@ option csharp_namespace = "NeoFS.API.Session"; import "service/meta.proto"; import "service/verify.proto"; +import "refs/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -17,8 +18,8 @@ service Session { // CreateRequest carries an information necessary for opening a session message CreateRequest { - // OwnerID carries an identifier of a session initiator - bytes OwnerID = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; + // OwnerID carries an identifier of a session initiator. + refs.OwnerID OwnerID = 1; // Lifetime carries a lifetime of the session service.TokenLifetime Lifetime = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false];