Skip to content

Commit

Permalink
arch: Adapt object split information according to nspcc-dev/neofs-api…
Browse files Browse the repository at this point in the history
…#283

Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Jan 31, 2024
1 parent fba34df commit b47ab7d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 01-arch/03-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ NeoFS stores all data in the form of objects, thus providing an object-based sto

ObjectID is a hash that equals Headers hashes plus Payload hashes. Any object includes a system header, extended headers, and a payload. A system header is an obligatory field, while extended headers may be omitted. However, any extended header should follow a particular structure (e.g. IntegrityHeader is a must). A user can add any extended header in the form of a key-value pair, though keeping in mind that it cannot be duplicated with several values. One attribute -- one value. Please note that any object initially has FileName, so that you cannot create an extended header with it as a key.

The maximum size for an object is fixed and can be changed only for the whole network in the main contract. It means that if a file is too heavy, it will be automatically divided into smaller objects. This smaller parts are put in a container and placed to a Storage Node. Later, they can be assembled to the initial object. Such assembling is performed in the storage nodes upon a corresponding request for a linking object. Once your file is converted into an object (or several objects), this object cannot be changed.
The maximum size for an object is fixed and can be changed only for the whole network in the main contract. It means that if a file is too heavy, it will be automatically divided into smaller objects. This smaller parts are put in a container and placed to a Storage Node. Later, they can be assembled to the original object. Such assembling is performed in the storage nodes upon a corresponding request for a linking object. Once your file is converted into an object (or several objects), this object cannot be changed.

One can define the format of the object in an API Specification. For more information, see [API Specification](https://github.com/nspcc-dev/neofs-api/tree/master/proto-docs).
19 changes: 12 additions & 7 deletions 01-arch/04-object_split.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@ For each part of the original object's payload, a separate object with own `Obje

![Large object split](pic/object_split_all)

All objects participating in the split have the `Split` headers set. Depending on the place in the split hierarchy it has different field combinations. There are four possible cases:
All objects participating in the split have the `Split` headers set. Depending on the place in the split hierarchy it has different field combinations. There are five possible cases:

* Initial object \
Initial object that expresses a desire to put a large object in the NeoFS network. It has `split_id` and `parent_header` fields set. The parent header is not finished: since there is no information about payload, it cannot be measured, hashed and signed (also, no object ID can be assigned). However, it has all user information attached to the object (e.g. attributes), and plays the role of representative of the original object until all the parts are uploaded to the NeoFS..

* First part \
First part object only has the `split_id` field set, as there is no more information known at this point
First part object only has the `split_id` and `init` fields set, as there is no more information known at this point

* Middle parts \
Middle parts have information about the previous part in `previous` field in addition to the `split_id`
Middle parts have information about the previous part in `previous` field in addition to the `split_id` and `init` pair

* Last part \
At this point all the information about the object under split is known. Hence the last part contains not only the `split_id` and `previous` fields, but also the `ObjectID` of the original large object in its `parent` field, signed `ObjectID` in `parent_signature` and original object's `Header` in `parent_header`.
At this point, all the information about the object under split is known. Hence, the last part contains not only the `split_id`, `init` and `previous` fields, but also the `ObjectID` of the original large object in its `parent` field, signed `ObjectID` in `parent_signature` and original object's `Header` in `parent_header`.

* Link object \
There are special "Link objects" that have the same common `split_id`, do not have any payload, but contain original object's `ObjectID` in `parent` field, it's signature in `parent_signature`, original object's `Header` in `parent_header` and the list of all object parts with payload in repeated `children` field. Link objects help to speed up the large object reconstruction and `HEAD` requests processing. If Link object is lost, the original large object still will be reconstructed from its parts, but it will require more actions from NeoFS nodes.
There are special "Link objects" that have the same common `split_id`, but also contain original object's `ObjectID` in `parent` field, its signature in `parent_signature`, original object's `Header` in `parent_header` and the list of all object part IDs paired with their sizes encoded in the payload. Link objects help to speed up the large object reconstruction and `HEAD` requests processing. If a Link object is lost, the original large object still will be reconstructed from its parts, but it will require more actions from NeoFS nodes.

All of the split hierarchy objects may be physically stored on different nodes. During reconstruction, at first the link object or the last part object will be found. If it's a HEAD request, the link object or the last part object will have all the information required to return the original large object's HEAD response. For a GET request, the payload will be taken from part objects listed in the Link object's payload. As they are ordered, it will be possible to begin streaming the payload as soon as the first part object becomes available. If a Link object is lost, some additional time will be spent on reconstructing the list from `split.previous` header fields.

All of the split hierarchy objects may be physically stored on different nodes. During reconstruction, at first the link object or the last part object will be found. If it's a HEAD request, the link object or the last part object will have all the information required to return the original large object's HEAD response. For a GET request, the payload will be taken from part objects listed in the `split.children` header. As they are ordered, it will be possible to begin streaming the payload as soon as the first part object becomes available. If Link object is lost, some additional time will be spent on reconstructing the list from `split.previous` header fields.
If the whole payload is available, a large object may be split on the client side using local tools like `neofs-cli`. In this case, the resulting object set will be signed with user's key. Such a split type can be called a "Static split".

If the whole payload is available, a large object may be split on the client side using local tools like `neofs-cli`. In this case the resulting object set will be signed with user's key. Such a split type can be called a "Static split".
There are attribute-based ACL rules in the NeoFS. Before the last part and the link object are created, the original object's parts should be validated according to the initial object's information about the original object.

When the large object's payload is not fully available right away, or it is too big to be split locally, the object upload can be started in a Session with another NeoFS node and be streamed in a PUT operation, part by part. Object parts will be automatically created as soon as the payload hits the MaxObjectSize limit. In this case, the resulting object set will be signed with a session key signed by user's key. This split type can be called a "Dynamic split".
2 changes: 1 addition & 1 deletion 01-arch/pic/object_split_all.drawio
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mxfile host="Electron" modified="2020-11-17T20:25:03.531Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/13.2.2 Chrome/83.0.4103.100 Electron/9.0.3 Safari/537.36" etag="4XlSeFVwTa0BWtAPGfQq" version="13.2.2" type="device"><diagram id="b3hDvS4LCimOuX0njIPD" name="Page-1">7V3dcuMmFH4aXzYjCUm2L2052e1Mts000+lub3aIhW12ZeFBeG336QsS2JLwj9pEQmnxZBJzBAjxfaDzA2QAovX+A4Wb1ScSo2TgOfF+AGYDz3PdIeB/hORQSIYiJQRLimOZ6SR4xn8hKXSkdItjlFUyMkIShjdV4ZykKZqzigxSSnbVbAuSVO+6gUukCZ7nMNGlf+CYrQrpyBue5B8RXq7Und1wXFxZQ5VZPkm2gjHZlUTgfgAiSggrvq33EUpE56l+Kco9XLgqG5axg2qqahFFKWtSw+GX2TL89jIDH79MPv252DwdPu5+ktX+gMlWVvuI0+9c8uvLN9G/9ZtmO7xOYMp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b3t8/PFjbsi0CGLctQ7uRplPAjduW4Y3Fkda27JYQPbAtb6yPPG9bWndzS3wwbluGurvR7q0yxQbje2mGtzxPdnNVt4wwvp9m2Gy7nd1d1YkF2XS3DfBaooOrhycfIV0i814pcajLf9krFcNslZdw38ZFBcZVF1UPTnhxdV3kgovKaiBNJpjjYH0/LipPV0Csh6JFwI27pIAOuNUuOwLfuHvK05VLO9pbBNy8+8nTo1DWdOgEeuOeJk/3RdvB3ibixr1Jnu5r1jbG8REfRfzX/b2NO7bGBONeJM/ukOvWjjN+LIunO4os4m0ibvzkFWBPXurYV2Nco7NbFbpF3Pj5KcMzY7yONUrjiTgsn6fmwn8tvNnTFVsrRz7vFXr4XE58ERjwzpXJmXLFF6mDSu0x+1z6XirFU6dCIqHK6FCoVfJkS+foypOqwcVEdOMajOoAEBRXDv/XQSyBFpzBTMkoSiDDP1ClueeAlHd4EsQ9ufWVA1VSxq9vfy0eXBY6sUGrp3b+Owhr9RT9otWTs+r40K8g2pmVau+SaD2hRX1BcjgCd+PSZ/TvWOLXaBKMuqWJul2JJr+nDLMExVz6CA+I6sg41UdqdJ8zjso6Hasxvd0KM/TM30Xi6o7CTZWblZDfxTBfORaoLbILwykY6JFH+VYl4jXIBCzgPD+v92fjMKIf1CaKka6VgHOvqBrj3uwVpWzd/kAVhiI23QOoRn2DqoE20TVUU68PUAVu36Bq8D7+f06A9SPpxjpS53X01qA642c3Par6MQFqJ36Yx0r3kBvHqiczYH0HXYtY8eTpX6cVqunpH9CB+78B</diagram></mxfile>
<mxfile host="Electron" modified="2024-01-31T16:04:08.090Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/23.0.2 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="9x-VonGxNzIyMC4zXjvD" version="23.0.2" type="device"><diagram id="b3hDvS4LCimOuX0njIPD" name="Page-1">7V1hc+IoGP41ftmZ68TExPSjxnZ359ruznXubve+7FCDyjYGJ+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KYE6u0xKHS0MUg5xU1+Nn1kk9ouYpzS7lejprg4uvdyWLP71ajfHScPU0gLZ86aKPkWzZ6j7fIiN6xRYy+PUtRkrBQlFnkdyJvcikaNvDxaYR0cfXib3IpGjfeJlzXYhRJG+WB0Lxo1IU7NkJdnP757+JRbA+/O4cRbHMh8IU6Y3JhGzQk7lmEUcJMbz6gXS9mBa6OAt763TCg7e3+nBJGEesKuQ11/2tdLN+9UL9vwOorpT/uUqnvg6xki8JFCz46uM7CoK141B/3g5OGq5y7ZIkEw9BQ6AScxZqwjDCjvF16+UtZn8x1rxWAS50S5g22FE557JbaKrE1PdnSxQuEMtItWEDAx6QLQEguMj6HlGUarwUiFabSG7kWgdR1eXttqIPf/nj3hnhQaNl2loW0FUKiwhtpuWJfRDe6vqLkArGT3tXWsLqMTlIa5NGJFgxnGpDq8RSt2do9jyM74Hw==</diagram></mxfile>
Binary file modified 01-arch/pic/object_split_all.pdf
Binary file not shown.
Loading

0 comments on commit b47ab7d

Please sign in to comment.