[#73] Add json field names to oblect struct

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2020-10-16 16:17:49 +03:00 committed by Stanislav Bogatyrev
parent a6ecab41b8
commit 4f01f4b902
2 changed files with 38 additions and 38 deletions

View file

@ -32,53 +32,53 @@ enum MatchType {
message ShortHeader {
// Object format version. Effectively the version of API library used to
// create particular object
neo.fs.v2.refs.Version version = 1;
neo.fs.v2.refs.Version version = 1 [json_name = "version"];
// Epoch when the object was created
uint64 creation_epoch = 2;
uint64 creation_epoch = 2 [json_name = "creationEpoch"];
// Object's owner
neo.fs.v2.refs.OwnerID owner_id = 3;
neo.fs.v2.refs.OwnerID owner_id = 3 [json_name = "owner"];
// Type of the object payload content
ObjectType object_type = 4;
ObjectType object_type = 4 [json_name = "type"];
// Size of payload in bytes.
// `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown
uint64 payload_length = 5;
uint64 payload_length = 5 [json_name = "payloadSize"];
}
// Object Header
message Header {
// Object format version. Effectively the version of API library used to
// create particular object
neo.fs.v2.refs.Version version = 1;
neo.fs.v2.refs.Version version = 1 [json_name = "version"];
// Object's container
neo.fs.v2.refs.ContainerID container_id = 2;
neo.fs.v2.refs.ContainerID container_id = 2 [json_name = "container"];
// Object's owner
neo.fs.v2.refs.OwnerID owner_id = 3;
neo.fs.v2.refs.OwnerID owner_id = 3 [json_name = "owner"];
// Object creation Epoch
uint64 creation_epoch = 4;
uint64 creation_epoch = 4 [json_name = "creationEpoch"];
// Size of payload in bytes.
// `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown
uint64 payload_length = 5;
uint64 payload_length = 5 [json_name = "payloadSize"];
// Hash of payload bytes
neo.fs.v2.refs.Checksum payload_hash = 6;
neo.fs.v2.refs.Checksum payload_hash = 6 [json_name = "payloadHash"];
// Type of the object payload content
ObjectType object_type = 7;
ObjectType object_type = 7 [json_name = "type"];
// Homomorphic hash of the object payload.
neo.fs.v2.refs.Checksum homomorphic_hash = 8;
neo.fs.v2.refs.Checksum homomorphic_hash = 8 [json_name = "homoHash"];
// Session token, if it was used during Object creation. Need it to verify
// integrity and authenticity out of Request scope.
neo.fs.v2.session.SessionToken session_token = 9;
neo.fs.v2.session.SessionToken session_token = 9 [json_name = "token"];
// `Attribute` is a user-defined Key-Value metadata pair attached to the
// object.
@ -93,12 +93,12 @@ message Header {
// corresponding section in NeoFS Technical specification.
message Attribute {
// string key to the object attribute
string key = 1;
string key = 1 [json_name = "key"];
// string value of the object attribute
string value = 2;
string value = 2 [json_name = "value"];
}
// User-defined object attributes
repeated Attribute attributes = 10;
repeated Attribute attributes = 10 [json_name = "attributes"];
// Bigger objects can be split into a chain of smaller objects. Information
// about inter-dependencies between spawned objects and how to re-construct
@ -106,22 +106,22 @@ message Header {
// must be within the same container.
message Split {
// Identifier of the origin object. Known only to the minor child.
neo.fs.v2.refs.ObjectID parent = 1;
neo.fs.v2.refs.ObjectID parent = 1 [json_name = "parent"];
// Identifier of the left split neighbor
neo.fs.v2.refs.ObjectID previous = 2;
neo.fs.v2.refs.ObjectID previous = 2[json_name = "previous"];
// `signature` field of the parent object. Used to reconstruct parent.
neo.fs.v2.refs.Signature parent_signature = 3;
neo.fs.v2.refs.Signature parent_signature = 3[json_name = "parentSignature"];
// `header` field of the parent object. Used to reconstruct parent.
Header parent_header = 4;
Header parent_header = 4 [json_name = "header"];
// List of identifiers of the objects generated by splitting current one.
repeated neo.fs.v2.refs.ObjectID children = 5;
repeated neo.fs.v2.refs.ObjectID children = 5 [json_name = "children"];
}
// Position of the object in the split hierarchy
Split split = 11;
Split split = 11 [json_name = "Split"];
}
// Object structure. Object is immutable and content-addressed. It means
@ -129,14 +129,14 @@ message Header {
// hash of header field, which contains hash of object's payload.
message Object {
// Object's unique identifier.
neo.fs.v2.refs.ObjectID object_id = 1;
neo.fs.v2.refs.ObjectID object_id = 1 [json_name = "id"];
// Signed object_id
neo.fs.v2.refs.Signature signature = 2;
neo.fs.v2.refs.Signature signature = 2 [json_name = "signature"];
// Object metadata headers
Header header = 3;
Header header = 3 [json_name = "header"];
// Payload bytes.
bytes payload = 4;
bytes payload = 4 [json_name = "payload"];
}

View file

@ -9,9 +9,9 @@ option csharp_namespace = "NeoFS.API.v2.Refs";
// format there MUST be a '/' delimeter between them.
message Address {
// Container identifier
ContainerID container_id = 1;
ContainerID container_id = 1 [json_name = "container"];
// Object identifier
ObjectID object_id = 2;
ObjectID object_id = 2 [json_name = "object"];
}
// NeoFS Object unique identifier. Objects are immutable and content-addressed.
@ -20,7 +20,7 @@ message Address {
// payload.
message ObjectID {
// Object identifier in a binary format
bytes value = 1;
bytes value = 1 [json_name = "value"];
}
// NeoFS container identifier. Container structures are immutable and
@ -28,7 +28,7 @@ message ObjectID {
// stable-marshalled container message.
message ContainerID {
// Container identifier in a binary format.
bytes value = 1;
bytes value = 1 [json_name = "value"];
}
// OwnerID is a derivative of a user's main public key. The transformation
@ -36,24 +36,24 @@ message ContainerID {
// be directly used as `OwnerID`.
message OwnerID {
// Identifier of the container owner in a binary format
bytes value = 1;
bytes value = 1 [json_name = "value"];
}
// API version used by a node.
message Version {
// Major API version
uint32 major = 1;
uint32 major = 1 [json_name = "major"];
// Minor API version
uint32 minor = 2;
uint32 minor = 2 [json_name = "minor"];
}
// Signature of something in NeoFS.
message Signature {
// Public key used for signing
bytes key = 1;
bytes key = 1 [json_name = "key"];
// Signature
bytes sign = 2;
bytes sign = 2 [json_name = "signature"];
}
// Checksum algorithm type.
@ -71,8 +71,8 @@ enum ChecksumType {
// Checksum message.
message Checksum {
// Checksum algorithm type
ChecksumType type = 1;
ChecksumType type = 1 [json_name = "type"];
// Checksum itself
bytes sum = 2;
bytes sum = 2 [json_name = "sum"];
}