Skip to content

Commit

Permalink
[nspcc-dev#194] Generate docs with recent protocol changes
Browse files Browse the repository at this point in the history
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
  • Loading branch information
Leonard Lyubich committed Feb 21, 2022
1 parent 9d7e61c commit b55fa44
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 26 deletions.
13 changes: 9 additions & 4 deletions proto-docs/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ Returns container structure from `Container` smart contract storage.

Statuses:
- **OK** (0, SECTION_SUCCESS):
container has been successfully read;
- Common failures (SECTION_FAILURE_COMMON).
container has been successfully read;
- Common failures (SECTION_FAILURE_COMMON);
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
requested container not found.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand Down Expand Up @@ -151,9 +153,12 @@ Returns Extended ACL table and signature from `Container` smart contract
storage.

Statuses:

- **OK** (0, SECTION_SUCCESS):
container eACL has been successfully read;
- Common failures (SECTION_FAILURE_COMMON).
container eACL has been successfully read;
- Common failures (SECTION_FAILURE_COMMON);
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
container not found.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand Down
58 changes: 58 additions & 0 deletions proto-docs/lock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Protocol Documentation

<a name="top"></a>

## Table of Contents

- [lock/types.proto](#lock/types.proto)

- Messages
- [Lock](#neo.fs.v2.lock.Lock)


- [Scalar Value Types](#scalar-value-types)

<a name="lock/types.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lock/types.proto

<!-- end services -->


<a name="neo.fs.v2.lock.Lock"></a>

### Message Lock

Lock objects protects a list of objects from being deleted. Lifetime of the lock object is limited similar to regular
objects in
`__NEOFS__EXPIRATION_EPOCH` attribute.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| members | [neo.fs.v2.refs.ObjectID](#neo.fs.v2.refs.ObjectID) | repeated | List of objects to lock. Must not be empty or carry empty IDs. All members must be of the `REGULAR` type. |

<!-- end messages -->

<!-- end enums -->

## Scalar Value Types

| .proto Type | Notes | C++ Type | Java Type | Python Type |
| ----------- | ----- | -------- | --------- | ----------- |
| <a name="double" /> double | | double | double | float |
| <a name="float" /> float | | float | float | float |
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int |
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long |
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long |
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long |
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int |
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long |
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int |
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long |
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int |
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long |
| <a name="bool" /> bool | | bool | boolean | boolean |
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode |
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str |

114 changes: 93 additions & 21 deletions proto-docs/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,18 @@ keeping receiving order.

Statuses:
- **OK** (0, SECTION_SUCCESS):
object has been successfully read;
- Common failures (SECTION_FAILURE_COMMON).
object has been successfully read;
- Common failures (SECTION_FAILURE_COMMON);
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
object container not found;
- **ACCESS_DENIED** (2048, SECTION_OBJECT):
read access to the object is denied;
- **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT):
object not found in container;
- **TOKEN_EXPIRED** (4097, SECTION_SESSION):
provided session token has expired;
- **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT):
the requested object has been marked as deleted.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand All @@ -110,9 +120,22 @@ object payload. All messages, except first one, SHOULD be payload chunks.
Chunk messages SHOULD be sent in direct order of fragmentation.

Statuses:

- **OK** (0, SECTION_SUCCESS):
object has been successfully saved in the container;
- Common failures (SECTION_FAILURE_COMMON).
object has been successfully saved in the container;
- Common failures (SECTION_FAILURE_COMMON);
- **LOCKED** (2050, SECTION_OBJECT):
placement of an object of type TOMBSTONE that includes at least one locked object is prohibited;
- **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT):
placement of an object of type LOCK that includes at least one object of type other than REGULAR is prohibited;
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
object storage container not found;
- **ACCESS_DENIED** (2048, SECTION_OBJECT):
write access to the container is denied;
- **TOKEN_NOT_FOUND** (4096, SECTION_SESSION):
(for trusted object preparation) session private key does not exist or has been deleted;
- **TOKEN_EXPIRED** (4097, SECTION_SESSION):
provided session token has expired.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand All @@ -123,9 +146,18 @@ Delete the object from a container. There is no immediate removal
guarantee. Object will be marked for removal and deleted eventually.

Statuses:

- **OK** (0, SECTION_SUCCESS):
object has been successfully marked to be removed from the container;
- Common failures (SECTION_FAILURE_COMMON).
object has been successfully marked to be removed from the container;
- Common failures (SECTION_FAILURE_COMMON);
- **LOCKED** (2050, SECTION_OBJECT):
deleting a locked object is prohibited;
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
object container not found;
- **ACCESS_DENIED** (2048, SECTION_OBJECT):
delete access to the object is denied;
- **TOKEN_EXPIRED** (4097, SECTION_SESSION):
provided session token has expired.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand All @@ -137,9 +169,20 @@ returned. If `main_only` request field is set, the short header with only
the very minimal information would be returned instead.

Statuses:

- **OK** (0, SECTION_SUCCESS):
object header has been successfully read;
- Common failures (SECTION_FAILURE_COMMON).
object header has been successfully read;
- Common failures (SECTION_FAILURE_COMMON);
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
object container not found;
- **ACCESS_DENIED** (2048, SECTION_OBJECT):
access to operation HEAD of the object is denied;
- **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT):
object not found in container;
- **TOKEN_EXPIRED** (4097, SECTION_SESSION):
provided session token has expired;
- **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT):
the requested object has been marked as deleted.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand All @@ -151,9 +194,16 @@ Header's filed values. Please see the corresponding NeoFS Technical
Specification section for more details.

Statuses:

- **OK** (0, SECTION_SUCCESS):
objects have been successfully selected;
- Common failures (SECTION_FAILURE_COMMON).
objects have been successfully selected;
- Common failures (SECTION_FAILURE_COMMON);
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
search container not found;
- **ACCESS_DENIED** (2048, SECTION_OBJECT):
access to operation SEARCH of the object is denied;
- **TOKEN_EXPIRED** (4097, SECTION_SESSION):
provided session token has expired.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand All @@ -166,9 +216,20 @@ restored by concatenation of all received payload chunks keeping receiving
order.

Statuses:

- **OK** (0, SECTION_SUCCESS):
data range of the object payload has been successfully read;
- Common failures (SECTION_FAILURE_COMMON).
data range of the object payload has been successfully read;
- Common failures (SECTION_FAILURE_COMMON);
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
object container not found;
- **ACCESS_DENIED** (2048, SECTION_OBJECT):
access to operation RANGE of the object is denied;
- **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT):
object not found in container;
- **TOKEN_EXPIRED** (4097, SECTION_SESSION):
provided session token has expired;
- **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT):
the requested object has been marked as deleted.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand All @@ -181,9 +242,18 @@ length) tuples. Hashes order in response corresponds to ranges order in
request. Note that hash is calculated for XORed data.

Statuses:

- **OK** (0, SECTION_SUCCESS):
data range of the object payload has been successfully hashed;
- Common failures (SECTION_FAILURE_COMMON).
data range of the object payload has been successfully hashed;
- Common failures (SECTION_FAILURE_COMMON);
- **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER):
object container not found;
- **ACCESS_DENIED** (2048, SECTION_OBJECT):
access to operation RANGEHASH of the object is denied;
- **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT):
object not found in container;
- **TOKEN_EXPIRED** (4097, SECTION_SESSION):
provided session token has expired.

| Name | Input | Output |
| ---- | ----- | ------ |
Expand Down Expand Up @@ -772,14 +842,15 @@ must be within the same container.
| children | [neo.fs.v2.refs.ObjectID](#neo.fs.v2.refs.ObjectID) | repeated | List of identifiers of the objects generated by splitting current one. |
| split_id | [bytes](#bytes) | | 16 byte UUIDv4 used to identify the split object hierarchy parts. Must be unique inside container. All objects participating in the split must have the same `split_id` value. |


<a name="neo.fs.v2.object.Object"></a>

### Message Object

Object structure. Object is immutable and content-addressed. It means
`ObjectID` will change if header or payload changes. It's calculated as a
hash of header field, which contains hash of object's payload.
`ObjectID` will change if header or payload changes. It's calculated as a hash of header field, which contains hash of
object's payload.

For non-regular object types payload format depends on object type specified in the header.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
Expand All @@ -788,7 +859,6 @@ hash of header field, which contains hash of object's payload.
| header | [Header](#neo.fs.v2.object.Header) | | Object metadata headers |
| payload | [bytes](#bytes) | | Payload bytes |


<a name="neo.fs.v2.object.ShortHeader"></a>

### Message ShortHeader
Expand Down Expand Up @@ -842,20 +912,22 @@ Type of match expression
<a name="neo.fs.v2.object.ObjectType"></a>

### ObjectType
Type of the object payload content. Only `REGULAR` type objects can be split,
hence `TOMBSTONE` and `STORAGE_GROUP` payload is limited by maximal object
size.

Type of the object payload content. Only `REGULAR` type objects can be split, hence `TOMBSTONE`, `STORAGE_GROUP`
and `LOCK` payload is limited by maximal object size.

String presentation of object type is the same as definition:
* REGULAR
* TOMBSTONE
* STORAGE_GROUP
* LOCK

| Name | Number | Description |
| ---- | ------ | ----------- |
| REGULAR | 0 | Just a normal object |
| TOMBSTONE | 1 | Used internally to identify deleted objects |
| STORAGE_GROUP | 2 | StorageGroup information |
| LOCK | 3 | Object lock |


<!-- end enums -->
Expand Down
6 changes: 5 additions & 1 deletion proto-docs/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ Section of statuses for object-related operations.

| Name | Number | Description |
| ---- | ------ | ----------- |
| ACCESS_DENIED | 0 | [**2048**] Access denied by ACL. Details: - [**0**] Human-readable description. |
| ACCESS_DENIED | 0 | [**2048**] Access denied by ACL. Details: - [**
0**] Human-readable description (UTF-8 encoded string). |
| OBJECT_NOT_FOUND | 1 | [**2049**] Object not found. |
| LOCKED | 2 | [**2050**] Operation rejected by the object lock. |
| LOCK_NON_REGULAR_OBJECT | 3 | [**2051**] Locking an object with a non-REGULAR type rejected. |
| OBJECT_ALREADY_REMOVED | 4 | [**2052**] Object has been marked deleted. |



Expand Down

0 comments on commit b55fa44

Please sign in to comment.