From 7b98b6a3afbb19428e8f5ab8596770eb5704c3c4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 24 Jan 2024 17:58:03 +0300 Subject: [PATCH] link: Add children sizes information It allows faster seeking through a split object without fetching the whole chain. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + link/types.proto | 20 +++++++++++++++----- proto-docs/link.md | 22 ++++++++++++++++++---- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26849c8..c4b30f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Well-known `Version` node attribute (#267) - `INIT` split chain object type (#283) - Link object payload message (#263) +- Children sizes index to the link objects (#264) ### Removed - Redundant object system attribute `__NEOFS__UPLOAD_ID` (#271) diff --git a/link/types.proto b/link/types.proto index 2bbd5e2..b7d78b5 100644 --- a/link/types.proto +++ b/link/types.proto @@ -11,10 +11,20 @@ import "refs/types.proto"; // chain objects' IDs. It is created only after the whole split chain is known // and signed. This object is the only object that refers to every "child object" // ID. It is NOT required for the original object assembling. It MUST have ALL -// the "child objects" IDs. IDs MUST be ordered according to the original payload -// split, meaning the first payload part holder MUST be placed at the first place -// in the corresponding link object. +// the "child objects" IDs. Child objects MUST be ordered according to the +// original payload split, meaning the first payload part holder MUST be placed +// at the first place in the corresponding link object. Sizes MUST NOT be omitted +// and MUST be a real object payload size in bytes. message Link { - // Full list of the "child" object IDs. - repeated neo.fs.v2.refs.ObjectID children = 1 [json_name = "children"]; + // Object ID with its object's payload size. + message MeasuredObject { + // Object ID. + neo.fs.v2.refs.ObjectID id = 1 [json_name = "id"]; + + // Object size in bytes. + uint32 size = 2 [json_name = "size"]; + } + + // Full list of the "child" object descriptors. + repeated MeasuredObject children = 1 [json_name = "children"]; } diff --git a/proto-docs/link.md b/proto-docs/link.md index a1596a0..a71626b 100644 --- a/proto-docs/link.md +++ b/proto-docs/link.md @@ -7,6 +7,7 @@ - Messages - [Link](#neo.fs.v2.link.Link) + - [Link.MeasuredObject](#neo.fs.v2.link.Link.MeasuredObject) - [Scalar Value Types](#scalar-value-types) @@ -29,14 +30,27 @@ Link is a payload of helper objects that contain the full list of the split chain objects' IDs. It is created only after the whole split chain is known and signed. This object is the only object that refers to every "child object" ID. It is NOT required for the original object assembling. It MUST have ALL -the "child objects" IDs. IDs MUST be ordered according to the original payload -split, meaning the first payload part holder MUST be placed at the first place -in the corresponding link object. +the "child objects" IDs. Child objects MUST be ordered according to the +original payload split, meaning the first payload part holder MUST be placed +at the first place in the corresponding link object. Sizes MUST NOT be omitted +and MUST be a real object payload size in bytes. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| children | [neo.fs.v2.refs.ObjectID](#neo.fs.v2.refs.ObjectID) | repeated | Full list of the "child" object IDs. | +| children | [Link.MeasuredObject](#neo.fs.v2.link.Link.MeasuredObject) | repeated | Full list of the "child" object descriptors. | + + + + +### Message Link.MeasuredObject +Object ID with its object's payload size. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [neo.fs.v2.refs.ObjectID](#neo.fs.v2.refs.ObjectID) | | Object ID. | +| size | [uint32](#uint32) | | Object size in bytes. |