From fccd753a5dc401f358726c87f221f3aedf1d7e15 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 5 Aug 2020 18:07:56 +0300 Subject: [PATCH] [#31] refs: Use ContainerID message in all services Change the type of all fields for the container identifier to refs.ContainerID. This will allow to follow a single format and not duplicate its description. Signed-off-by: Leonard Lyubich --- acl/types.proto | 5 +++-- container/service.proto | 23 ++++++++++++----------- object/service.proto | 4 ++-- proto-docs/container.md | 10 +++++----- proto-docs/object.md | 2 +- proto-docs/refs.md | 2 +- refs/types.proto | 4 ++-- 7 files changed, 26 insertions(+), 24 deletions(-) diff --git a/acl/types.proto b/acl/types.proto index 91e012f..2479ef8 100644 --- a/acl/types.proto +++ b/acl/types.proto @@ -3,6 +3,7 @@ package acl; option go_package = "github.com/nspcc-dev/neofs-api-go/acl"; option csharp_namespace = "NeoFS.API.Acl"; +import "refs/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -101,8 +102,8 @@ message EACLRecord { // EACLRecord carries the information about extended ACL rules. message EACLTable { - // ContainerID of the container that should use given access control rules. - bytes ContainerID = 1 [json_name="ContainerID"]; + // Carries identifier of the container that should use given access control rules. + refs.ContainerID ContainerID = 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 1ad1a8d..28fdd3b 100644 --- a/container/service.proto +++ b/container/service.proto @@ -5,6 +5,7 @@ option csharp_namespace = "NeoFS.API.Container"; import "acl/types.proto"; import "container/types.proto"; +import "refs/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -52,25 +53,25 @@ message PutRequest { } message PutResponse { - // ContainerID of the new container. - bytes ContainerID = 1; + // ContainerID carries identifier of the new container. + refs.ContainerID ContainerID = 1; } message DeleteRequest { - // ContainerID of container to delete from NeoFS. - bytes ContainerID = 1; + // ContainerID carries identifier of the container to delete from NeoFS. + refs.ContainerID ContainerID = 1; // Signature of container id according to RFC-6979. bytes Signature = 2; } // DeleteResponse is empty because delete operation is asynchronous and done // via consensus in inner ring nodes -message DeleteResponse { } +message DeleteResponse {} message GetRequest { - // ContainerID of the container to get. - bytes ContainerID = 1; + // ContainerID carries identifier of the container to get. + refs.ContainerID ContainerID = 1; } message GetResponse { @@ -84,8 +85,8 @@ message ListRequest { } message ListResponse { - // ContainerIDs of containers that belong to the owner. - repeated bytes ContainerIDs = 1; + // ContainerIDs carries list of identifiers of the containers that belong to the owner. + repeated refs.ContainerID ContainerIDs = 1; } message SetExtendedACLRequest { @@ -98,8 +99,8 @@ message SetExtendedACLRequest { message SetExtendedACLResponse {} message GetExtendedACLRequest { - // ContainerID of the container that has Extended ACL. - bytes ContainerID = 1; + // ContainerID carries identifier of the container that has Extended ACL. + refs.ContainerID ContainerID = 1; } message GetExtendedACLResponse { diff --git a/object/service.proto b/object/service.proto index 9affad7..19b78a4 100644 --- a/object/service.proto +++ b/object/service.proto @@ -138,8 +138,8 @@ message HeadResponse { } message SearchRequest { - // ContainerID for searching the object - bytes ContainerID = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; + // ContainerID carries search container identifier. + refs.ContainerID ContainerID = 1; // Query in the binary serialized format bytes Query = 2; // QueryVersion is a version of search query format diff --git a/proto-docs/container.md b/proto-docs/container.md index b0b539f..03f9436 100644 --- a/proto-docs/container.md +++ b/proto-docs/container.md @@ -120,7 +120,7 @@ smart-contract storage. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ContainerID | [bytes](#bytes) | | ContainerID of container to delete from NeoFS. | +| ContainerID | [refs.ContainerID](#refs.ContainerID) | | ContainerID carries identifier of the container to delete from NeoFS. | | Signature | [bytes](#bytes) | | Signature of container id according to RFC-6979. | @@ -140,7 +140,7 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ContainerID | [bytes](#bytes) | | ContainerID of the container that has Extended ACL. | +| ContainerID | [refs.ContainerID](#refs.ContainerID) | | ContainerID carries identifier of the container that has Extended ACL. | @@ -163,7 +163,7 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ContainerID | [bytes](#bytes) | | ContainerID of the container to get. | +| ContainerID | [refs.ContainerID](#refs.ContainerID) | | ContainerID carries identifier of the container to get. | @@ -196,7 +196,7 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ContainerIDs | [bytes](#bytes) | repeated | ContainerIDs of containers that belong to the owner. | +| ContainerIDs | [refs.ContainerID](#refs.ContainerID) | repeated | ContainerIDs carries list of identifiers of the containers that belong to the owner. | @@ -220,7 +220,7 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ContainerID | [bytes](#bytes) | | ContainerID of the new container. | +| ContainerID | [refs.ContainerID](#refs.ContainerID) | | ContainerID carries identifier of the new container. | diff --git a/proto-docs/object.md b/proto-docs/object.md index 29d9955..03e60e2 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -327,7 +327,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| ContainerID | [bytes](#bytes) | | ContainerID for searching the object | +| ContainerID | [refs.ContainerID](#refs.ContainerID) | | ContainerID carries search container identifier. | | Query | [bytes](#bytes) | | Query in the binary serialized format | | QueryVersion | [uint32](#uint32) | | QueryVersion is a version of search query format | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | diff --git a/proto-docs/refs.md b/proto-docs/refs.md index 06470a2..fce3da2 100644 --- a/proto-docs/refs.md +++ b/proto-docs/refs.md @@ -33,7 +33,7 @@ Address of object (container id + object id) | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | ObjectID | [ObjectID](#refs.ObjectID) | | ObjectID carries object identifier. | -| CID | [bytes](#bytes) | | CID is container identifier | +| ContainerID | [ContainerID](#refs.ContainerID) | | ContainerID carries container identifier. | diff --git a/refs/types.proto b/refs/types.proto index 3f5c11a..f952c5a 100644 --- a/refs/types.proto +++ b/refs/types.proto @@ -14,8 +14,8 @@ option (gogoproto.goproto_stringer_all) = false; message Address { // ObjectID carries object identifier. ObjectID ObjectID = 1; - // CID is container identifier - bytes CID = 2[(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + // ContainerID carries container identifier. + ContainerID ContainerID = 2; } // ObjectID groups information about the NeoFS object identifier.