From f56ccf36b121f416137dade7e43573171cbd1186 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 28 Feb 2024 13:42:59 +0300 Subject: [PATCH] [#41] object: Support erasure codes Signed-off-by: Evgenii Stratonikov --- object/service.proto | 9 +++++++++ object/types.proto | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/object/service.proto b/object/service.proto index 2a3c6ff..3f727f4 100644 --- a/object/service.proto +++ b/object/service.proto @@ -319,6 +319,9 @@ message GetResponse { // Meta information of split hierarchy for object assembly. SplitInfo split_info = 3; + + // Meta information for EC object assembly. + ECInfo ec_info = 4; } } // Body of get object response message. @@ -503,6 +506,9 @@ message HeadResponse { // Meta information of split hierarchy. SplitInfo split_info = 3; + + // Meta information for EC object assembly. + ECInfo ec_info = 4; } } // Body of head object response message. @@ -678,6 +684,9 @@ message GetRangeResponse { // Meta information of split hierarchy. SplitInfo split_info = 2; + + // Meta information for EC object assembly. + ECInfo ec_info = 3; } } diff --git a/object/types.proto b/object/types.proto index dfc3afc..5b02365 100644 --- a/object/types.proto +++ b/object/types.proto @@ -193,6 +193,24 @@ message Header { } // Position of the object in the split hierarchy Split split = 11 [ json_name = "split" ]; + + // Erasure code can be applied to any object. + // Information about encoded object structure is stored in `EC` header. + // All objects belonging to a single EC group have the same `parent` field. + message EC { + // Identifier of the origin object. Known to all chunks. + neo.fs.v2.refs.ObjectID parent = 1 [ json_name = "parent" ]; + // Index of this chunk. + uint32 index = 2 [ json_name = "index" ]; + // Total number of chunks in this split. + uint32 total = 3 [ json_name = "total" ]; + // Total length of a parent header. Used to trim padding zeroes. + uint32 header_length = 4 [ json_name = "headerLength" ]; + // Chunk of a parent header. + bytes header = 5 [ json_name = "header" ]; + } + // Erasure code chunk information. + EC ec = 12 [ json_name = "ec" ]; } // Object structure. Object is immutable and content-addressed. It means @@ -232,3 +250,17 @@ message SplitInfo { // object parts. neo.fs.v2.refs.ObjectID link = 3; } + +// Meta information for the erasure-encoded object. +message ECInfo { + message Chunk { + // Object ID of the chunk. + neo.fs.v2.refs.ObjectID id = 1; + // Index of the chunk. + uint32 index = 2; + // Total number of chunks in this split. + uint32 total = 3; + } + // Chunk stored on the node. + repeated Chunk chunks = 1; +} \ No newline at end of file