[#50] Add version fields where it makes sense

Some pieces of data (container, object, etc) may be stored for a long time and
there will be a need in the future to understand which obscure format from the
past was used to create it.

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Stanislav Bogatyrev 2020-08-14 22:44:32 +03:00 committed by Alex Vanin
parent 7555e166b2
commit 4e908a17b1
4 changed files with 23 additions and 17 deletions

View file

@ -7,21 +7,26 @@ option csharp_namespace = "NeoFS.API.v2.Container";
import "netmap/types.proto"; import "netmap/types.proto";
import "refs/types.proto"; import "refs/types.proto";
import "service/meta.proto";
// Container is a structure that defines object placement behaviour. Objects // Container is a structure that defines object placement behaviour. Objects
// can be stored only within containers. They define placement rule, attributes // can be stored only within containers. They define placement rule, attributes
// and access control information. ID of the container is a 32 byte long // and access control information. ID of the container is a 32 byte long
// SHA256 hash of stable-marshalled container message. // SHA256 hash of stable-marshalled container message.
message Container { message Container {
// Container format version.
// Effectively the version of API library used to create container
neo.fs.v2.service.Version version = 1;
// OwnerID carries identifier of the container owner. // OwnerID carries identifier of the container owner.
neo.fs.v2.refs.OwnerID owner_id = 1; neo.fs.v2.refs.OwnerID owner_id = 2;
// Nonce is a 16 byte UUID, used to avoid collisions of container id. // Nonce is a 16 byte UUID, used to avoid collisions of container id.
bytes nonce = 2; bytes nonce = 3;
// BasicACL contains access control rules for owner, system, others groups and // BasicACL contains access control rules for owner, system, others groups and
// permission bits for bearer token and Extended ACL. // permission bits for bearer token and Extended ACL.
uint32 basic_acl = 3; uint32 basic_acl = 4;
// Attribute is a key-value pair of strings. // Attribute is a key-value pair of strings.
message Attribute { message Attribute {
@ -32,8 +37,8 @@ message Container {
string value = 2; string value = 2;
} }
// Attributes define any immutable characteristics of container. // Attributes define any immutable characteristics of container.
repeated Attribute attributes = 4; repeated Attribute attributes = 5;
// Placement policy for the object inside the container. // Placement policy for the object inside the container.
neo.fs.v2.netmap.PlacementPolicy placement_policy = 5; neo.fs.v2.netmap.PlacementPolicy placement_policy = 6;
} }

View file

@ -50,18 +50,18 @@ message ShortHeader {
// Object Headers // Object Headers
message Header { message Header {
// Object's container
neo.fs.v2.refs.ContainerID container_id = 1;
// Object's owner
neo.fs.v2.refs.OwnerID owner_id = 2;
// Epoch when the object was created
uint64 creation_epoch = 3;
// Object format version. // Object format version.
// Effectively the version of API library used to create particular object // Effectively the version of API library used to create particular object
neo.fs.v2.service.Version version = 4; neo.fs.v2.service.Version version = 1;
// Object's container
neo.fs.v2.refs.ContainerID container_id = 2;
// Object's owner
neo.fs.v2.refs.OwnerID owner_id = 3;
// Object creation Epoch
uint64 creation_epoch = 4;
// Size of payload in bytes. // Size of payload in bytes.
// 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown // 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown

View file

@ -435,6 +435,7 @@ SHA256 hash of stable-marshalled container message.
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| version | [neo.fs.v2.service.Version](#neo.fs.v2.service.Version) | | Container format version. Effectively the version of API library used to create container |
| owner_id | [neo.fs.v2.refs.OwnerID](#neo.fs.v2.refs.OwnerID) | | OwnerID carries identifier of the container owner. | | owner_id | [neo.fs.v2.refs.OwnerID](#neo.fs.v2.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. | | nonce | [bytes](#bytes) | | Nonce is a 16 byte UUID, used to avoid collisions of container id. |
| basic_acl | [uint32](#uint32) | | BasicACL contains access control rules for owner, system, others groups and permission bits for bearer token and Extended ACL. | | basic_acl | [uint32](#uint32) | | BasicACL contains access control rules for owner, system, others groups and permission bits for bearer token and Extended ACL. |

View file

@ -569,10 +569,10 @@ Object Headers
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| version | [neo.fs.v2.service.Version](#neo.fs.v2.service.Version) | | Object format version. Effectively the version of API library used to create particular object |
| container_id | [neo.fs.v2.refs.ContainerID](#neo.fs.v2.refs.ContainerID) | | Object's container | | container_id | [neo.fs.v2.refs.ContainerID](#neo.fs.v2.refs.ContainerID) | | Object's container |
| owner_id | [neo.fs.v2.refs.OwnerID](#neo.fs.v2.refs.OwnerID) | | Object's owner | | owner_id | [neo.fs.v2.refs.OwnerID](#neo.fs.v2.refs.OwnerID) | | Object's owner |
| creation_epoch | [uint64](#uint64) | | Epoch when the object was created | | creation_epoch | [uint64](#uint64) | | Object creation Epoch |
| version | [neo.fs.v2.service.Version](#neo.fs.v2.service.Version) | | Object format version. Effectively the version of API library used to create particular object |
| payload_length | [uint64](#uint64) | | Size of payload in bytes. 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown | | payload_length | [uint64](#uint64) | | Size of payload in bytes. 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown |
| payload_hash | [bytes](#bytes) | | Hash of payload bytes | | payload_hash | [bytes](#bytes) | | Hash of payload bytes |
| object_type | [ObjectType](#neo.fs.v2.object.ObjectType) | | Special object type | | object_type | [ObjectType](#neo.fs.v2.object.ObjectType) | | Special object type |