From 81a4adb202370a05867cab980066406b961c8b50 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 4 Aug 2020 23:36:24 +0300 Subject: [PATCH] [#26] object: Use nested types in ExtendedHeader This commit replaces all message definitions related to extended header to ExtendedHeader message. Signed-off-by: Leonard Lyubich --- object/types.proto | 126 ++++++++++++++++++++++--------------------- proto-docs/object.md | 106 ++++++++++++++++++------------------ 2 files changed, 117 insertions(+), 115 deletions(-) diff --git a/object/types.proto b/object/types.proto index 33f8147..d22a938 100644 --- a/object/types.proto +++ b/object/types.proto @@ -7,33 +7,76 @@ import "refs/types.proto"; import "service/verify.proto"; import "storagegroup/types.proto"; -// Attribute groups the parameters of the object attributes. -message Attribute { - // Key carries the string key to the object attribute. - string Key = 1; - - // Value carries the string value of the object attribute. - string Value = 2; -} - message ExtendedHeader { - // Integrity header with checksum of all above headers in the object - IntegrityHeader Integrity = 1; + // Integrity groups evidence of the integrity of an object's structure. + message Integrity { + // PayloadChecksum carries the checksum of object payload bytes. + // Changing any byte of the payload changes the checksum. + // It is calculated as a SHA-256 hash over payload bytes. + bytes PayloadChecksum = 1; + // HeaderChecksum carries checksum of the object header structure. + // It covers all object attributes. Changing any field of the object except + // CreatorKey and ChecksumSignature changes the checksum. + // PayloadChecksum and HeaderChecksum cannot be merged due to the need + // to verify the header in the absence of a payload (e.g. in object.Head rpc). + // It is calculated as a SHA-256 hash over marshaled object header + // with cut CreatorKey and ChecksumSignature. + bytes HeaderChecksum = 2; + // SessionToken carries token of the session within which the object was created. + // If session token is presented in object, it acts as the user's proof of the + // correctness of the CreatorKey. + service.Token SessionToken = 3; + // CreatorKey carries public key of the object creator in a binary format. + bytes CreatorKey = 4; + // ChecksumSignature carries signature of the structure checksum by the object creator. + bytes ChecksumSignature = 5; + } + // Integrity carries object integrity evidence. + Integrity integrity = 1; + + // Attribute groups the parameters of the object attributes. + message Attribute { + // Key carries the string key to the object attribute. + string Key = 1; + + // Value carries the string value of the object attribute. + string Value = 2; + } // Attributes carries list of the object attributes in a string key-value format. repeated Attribute Attributes = 2; // CreationEpoch carries number of NeoFS epoch on which the object was created. uint64 CreationEpoch = 3; - // Tombstone header that set up in deleted objects - Tombstone Tombstone = 4; - // HomoHash is a homomorphic hash of original object payload - bytes HomoHash = 5; - // StorageGroup contains meta information for the data audit - storagegroup.StorageGroup StorageGroup = 6; - // Split carries the position of the object in the split hierarchy. - SplitHeader SplitHeader = 7; -} -message Tombstone {} + // Tombstone groups the options for deleting an object. + message Tombstone { + } + // Tombstone marks the object to be deleted. + Tombstone tombstone = 4; + // HomomorphicHash carries homomorphic hash of the object payload. + bytes HomomorphicHash = 5; + // StorageGroup carries information about the NeoFS storage group. + storagegroup.StorageGroup StorageGroup = 6; + + // Split groups information about spawning the object through a payload splitting. + message Split { + // Parent carries identifier of the origin object. + refs.ObjectID Parent = 1; + + // Previous carries identifier of the left split neighbor. + refs.ObjectID Previous = 2; + + // Previous carries identifier of the right split neighbor. + refs.ObjectID Next = 3; + + // Children carries list of identifiers of the objects generated by splitting the current. + repeated refs.ObjectID Children = 4; + + // Origin carries the header of the origin object. + Header Origin = 5; + } + // Split carries the position of the object in the split hierarchy. + Split split = 7; +} message SystemHeader { // PayloadLength is an object payload length @@ -45,47 +88,6 @@ message SystemHeader { bytes OwnerID = 3; } -message IntegrityHeader { - // PayloadChecksum carries the checksum of object payload bytes. - // Changing any byte of the payload changes the checksum. - // It is calculated as a SHA-256 hash over payload bytes. - bytes PayloadChecksum = 1; - // HeaderChecksum carries checksum of the object header structure. - // It covers all object attributes. Changing any field of the object except - // CreatorKey and ChecksumSignature changes the checksum. - // PayloadChecksum and HeaderChecksum cannot be merged due to the need - // to verify the header in the absence of a payload (e.g. in object.Head rpc). - // It is calculated as a SHA-256 hash over marshaled object header - // with cut CreatorKey and ChecksumSignature. - bytes HeaderChecksum = 2; - // SessionToken carries token of the session within which the object was created. - // If session token is presented in object, it acts as the user's proof of the - // correctness of the CreatorKey. - service.Token SessionToken = 3; - // CreatorKey carries public key of the object creator in a binary format. - bytes CreatorKey = 4; - // ChecksumSignature is an user's signature of checksum to verify if it is correct - bytes ChecksumSignature = 5; -} - -// SplitHeader groups information about spawning the object through a payload splitting. -message SplitHeader { - // Parent carries identifier of the origin object. - refs.ObjectID Parent = 1; - - // Previous carries identifier of the left split neighbor. - refs.ObjectID Previous = 2; - - // Previous carries identifier of the right split neighbor. - refs.ObjectID Next = 3; - - // Children carries list of identifiers of the objects generated by splitting the current. - repeated refs.ObjectID Children = 4; - - // Origin carries the header of the origin object. - Header Origin = 5; -} - // Header groups the information about the NeoFS object. message Header { // SystemHeader describes system header diff --git a/proto-docs/object.md b/proto-docs/object.md index 4708165..256c20a 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -29,14 +29,14 @@ - [object/types.proto](#object/types.proto) - Messages - - [Attribute](#object.Attribute) - [ExtendedHeader](#object.ExtendedHeader) + - [ExtendedHeader.Attribute](#object.ExtendedHeader.Attribute) + - [ExtendedHeader.Integrity](#object.ExtendedHeader.Integrity) + - [ExtendedHeader.Split](#object.ExtendedHeader.Split) + - [ExtendedHeader.Tombstone](#object.ExtendedHeader.Tombstone) - [Header](#object.Header) - - [IntegrityHeader](#object.IntegrityHeader) - [Object](#object.Object) - - [SplitHeader](#object.SplitHeader) - [SystemHeader](#object.SystemHeader) - - [Tombstone](#object.Tombstone) - [Scalar Value Types](#scalar-value-types) @@ -359,9 +359,26 @@ in distributed system. - + -### Message Attribute +### Message ExtendedHeader + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| integrity | [ExtendedHeader.Integrity](#object.ExtendedHeader.Integrity) | | Integrity carries object integrity evidence. | +| Attributes | [ExtendedHeader.Attribute](#object.ExtendedHeader.Attribute) | repeated | Attributes carries list of the object attributes in a string key-value format. | +| CreationEpoch | [uint64](#uint64) | | CreationEpoch carries number of NeoFS epoch on which the object was created. | +| tombstone | [ExtendedHeader.Tombstone](#object.ExtendedHeader.Tombstone) | | Tombstone marks the object to be deleted. | +| HomomorphicHash | [bytes](#bytes) | | HomomorphicHash carries homomorphic hash of the object payload. | +| StorageGroup | [storagegroup.StorageGroup](#storagegroup.StorageGroup) | | StorageGroup carries information about the NeoFS storage group. | +| split | [ExtendedHeader.Split](#object.ExtendedHeader.Split) | | Split carries the position of the object in the split hierarchy. | + + + + +### Message ExtendedHeader.Attribute Attribute groups the parameters of the object attributes. @@ -371,21 +388,41 @@ Attribute groups the parameters of the object attributes. | Value | [string](#string) | | Value carries the string value of the object attribute. | - - -### Message ExtendedHeader + +### Message ExtendedHeader.Integrity +Integrity groups evidence of the integrity of an object's structure. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Integrity | [IntegrityHeader](#object.IntegrityHeader) | | Integrity header with checksum of all above headers in the object | -| Attributes | [Attribute](#object.Attribute) | repeated | Attributes carries list of the object attributes in a string key-value format. | -| CreationEpoch | [uint64](#uint64) | | CreationEpoch carries number of NeoFS epoch on which the object was created. | -| Tombstone | [Tombstone](#object.Tombstone) | | Tombstone header that set up in deleted objects | -| HomoHash | [bytes](#bytes) | | HomoHash is a homomorphic hash of original object payload | -| StorageGroup | [storagegroup.StorageGroup](#storagegroup.StorageGroup) | | StorageGroup contains meta information for the data audit | -| SplitHeader | [SplitHeader](#object.SplitHeader) | | Split carries the position of the object in the split hierarchy. | +| PayloadChecksum | [bytes](#bytes) | | PayloadChecksum carries the checksum of object payload bytes. Changing any byte of the payload changes the checksum. It is calculated as a SHA-256 hash over payload bytes. | +| HeaderChecksum | [bytes](#bytes) | | HeaderChecksum carries checksum of the object header structure. It covers all object attributes. Changing any field of the object except CreatorKey and ChecksumSignature changes the checksum. PayloadChecksum and HeaderChecksum cannot be merged due to the need to verify the header in the absence of a payload (e.g. in object.Head rpc). It is calculated as a SHA-256 hash over marshaled object header with cut CreatorKey and ChecksumSignature. | +| SessionToken | [service.Token](#service.Token) | | SessionToken carries token of the session within which the object was created. If session token is presented in object, it acts as the user's proof of the correctness of the CreatorKey. | +| CreatorKey | [bytes](#bytes) | | CreatorKey carries public key of the object creator in a binary format. | +| ChecksumSignature | [bytes](#bytes) | | ChecksumSignature carries signature of the structure checksum by the object creator. | + + + + +### Message ExtendedHeader.Split +Split groups information about spawning the object through a payload splitting. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Parent | [refs.ObjectID](#refs.ObjectID) | | Parent carries identifier of the origin object. | +| Previous | [refs.ObjectID](#refs.ObjectID) | | Previous carries identifier of the left split neighbor. | +| Next | [refs.ObjectID](#refs.ObjectID) | | Previous carries identifier of the right split neighbor. | +| Children | [refs.ObjectID](#refs.ObjectID) | repeated | Children carries list of identifiers of the objects generated by splitting the current. | +| Origin | [Header](#object.Header) | | Origin carries the header of the origin object. | + + + + +### Message ExtendedHeader.Tombstone +Tombstone groups the options for deleting an object. + @@ -400,21 +437,6 @@ Header groups the information about the NeoFS object. | ExtendedHeader | [ExtendedHeader](#object.ExtendedHeader) | | ExtendedHeader carries the additional part of the header. | - - -### Message IntegrityHeader - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| PayloadChecksum | [bytes](#bytes) | | PayloadChecksum carries the checksum of object payload bytes. Changing any byte of the payload changes the checksum. It is calculated as a SHA-256 hash over payload bytes. | -| HeaderChecksum | [bytes](#bytes) | | HeaderChecksum carries checksum of the object header structure. It covers all object attributes. Changing any field of the object except CreatorKey and ChecksumSignature changes the checksum. PayloadChecksum and HeaderChecksum cannot be merged due to the need to verify the header in the absence of a payload (e.g. in object.Head rpc). It is calculated as a SHA-256 hash over marshaled object header with cut CreatorKey and ChecksumSignature. | -| SessionToken | [service.Token](#service.Token) | | SessionToken carries token of the session within which the object was created. If session token is presented in object, it acts as the user's proof of the correctness of the CreatorKey. | -| CreatorKey | [bytes](#bytes) | | CreatorKey carries public key of the object creator in a binary format. | -| ChecksumSignature | [bytes](#bytes) | | ChecksumSignature is an user's signature of checksum to verify if it is correct | - - ### Message Object @@ -427,21 +449,6 @@ Header groups the information about the NeoFS object. | Payload | [bytes](#bytes) | | Payload is an object's payload | - - -### Message SplitHeader -SplitHeader groups information about spawning the object through a payload splitting. - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Parent | [refs.ObjectID](#refs.ObjectID) | | Parent carries identifier of the origin object. | -| Previous | [refs.ObjectID](#refs.ObjectID) | | Previous carries identifier of the left split neighbor. | -| Next | [refs.ObjectID](#refs.ObjectID) | | Previous carries identifier of the right split neighbor. | -| Children | [refs.ObjectID](#refs.ObjectID) | repeated | Children carries list of identifiers of the objects generated by splitting the current. | -| Origin | [Header](#object.Header) | | Origin carries the header of the origin object. | - - ### Message SystemHeader @@ -454,13 +461,6 @@ SplitHeader groups information about spawning the object through a payload split | 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 is a wallet address | - - - -### Message Tombstone - - -