frostfs-api/proto-docs/object.md
Leonard Lyubich b088391294 [#40] service: Rename Token to SessionToken
Rename Token message to SessionToken to clarify its purpose.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-08-11 11:50:36 +03:00

22 KiB

Protocol Documentation

Table of Contents

Top

object/service.proto

Service "object.Service"

Object service provides API for manipulating with the object.

rpc Get(GetRequest) returns (stream GetResponse);
rpc Put(stream PutRequest) returns (PutResponse);
rpc Delete(DeleteRequest) returns (DeleteResponse);
rpc Head(HeadRequest) returns (HeadResponse);
rpc Search(SearchRequest) returns (stream SearchResponse);
rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse);
rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse);

Method Get

Get the object from container. Response uses gRPC stream. First response message carry object of requested address. Chunk messages are parts of the object's payload if it is needed. All messages except first carry chunks. Requested object can be restored by concatenation of object message payload and all chunks keeping receiving order.

Name Input Output
Get GetRequest GetResponse

Method Put

Put the object into container. Request uses gRPC stream. First message SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD BE set. Session token SHOULD BE obtained before put operation (see session package). Chunk messages considered by server as part of object payload. All messages except first SHOULD BE chunks. Chunk messages SHOULD BE sent in direct order of fragmentation.

Name Input Output
Put PutRequest PutResponse

Method Delete

Delete the object from a container

Name Input Output
Delete DeleteRequest DeleteResponse

Method Head

Head returns the object without data payload. Object in the response has system header only. If full headers flag is set, extended headers are also present.

Name Input Output
Head HeadRequest HeadResponse

Search objects in container. Version of query language format SHOULD BE set to 1. Search query represented in serialized format (see query package).

Name Input Output
Search SearchRequest SearchResponse

Method GetRange

GetRange of data payload. Range is a pair (offset, length). Requested range can be restored by concatenation of all chunks keeping receiving order.

Name Input Output
GetRange GetRangeRequest GetRangeResponse

Method GetRangeHash

GetRangeHash returns homomorphic hash of object payload range after XOR operation. Ranges are set of pairs (offset, length). Hashes order in response corresponds to ranges order in request. Homomorphic hash is calculated for XORed data.

Name Input Output
GetRangeHash GetRangeHashRequest GetRangeHashResponse

Message DeleteRequest

Field Type Label Description
address refs.Address Carries the address of the object to be deleted.
owner_id refs.OwnerID Carries identifier the object owner.
meta_header service.RequestMetaHeader Carries request meta information. Header data is used only to regulate message transport and does not affect request execution.
verify_header service.RequestVerificationHeader Carries request verification information. This header is used to authenticate the nodes of the message route and check the correctness of transmission.

Message DeleteResponse

DeleteResponse is empty because we cannot guarantee permanent object removal in distributed system.

Message GetRangeHashRequest

Field Type Label Description
address refs.Address Carries address of the object that contains the requested payload range.
ranges Range repeated Carries the list of object payload range to calculate homomorphic hash.
salt bytes Carries binary salt to XOR object payload ranges before hash calculation.
meta_header service.RequestMetaHeader Carries request meta information. Header data is used only to regulate message transport and does not affect request execution.
verify_header service.RequestVerificationHeader Carries request verification information. This header is used to authenticate the nodes of the message route and check the correctness of transmission.

Message GetRangeHashResponse

Field Type Label Description
hash_list bytes repeated Carries list of homomorphic hashes in a binary format.

Message GetRangeRequest

Field Type Label Description
address refs.Address Address carries address of the object that contains the requested payload range.
range Range Range carries the parameters of the requested payload range.
meta_header service.RequestMetaHeader Carries request meta information. Header data is used only to regulate message transport and does not affect request execution.
verify_header service.RequestVerificationHeader Carries request verification information. This header is used to authenticate the nodes of the message route and check the correctness of transmission.

Message GetRangeResponse

Field Type Label Description
chunk bytes Carries part of the object payload.

Message GetRequest

Field Type Label Description
address refs.Address Carries the address of the requested object.
raw bool Carries the raw option flag of the request. Raw request is sent to receive only the objects that are physically stored on the server.
meta_header service.RequestMetaHeader Carries request meta information. Header data is used only to regulate message transport and does not affect request execution.
verify_header service.RequestVerificationHeader Carries request verification information. This header is used to authenticate the nodes of the message route and check the correctness of transmission.

Message GetResponse

Field Type Label Description
header Header Carries the object header.
chunk bytes Carries part of the object payload.

Message HeadRequest

Field Type Label Description
address refs.Address Carries the address of the object with the requested header.
main_only bool Carries the option to crop header to main part.
raw bool Carries the raw option flag of the request. Raw request is sent to receive only the headers of the objects that are physically stored on the server.
meta_header service.RequestMetaHeader Carries request meta information. Header data is used only to regulate message transport and does not affect request execution.
verify_header service.RequestVerificationHeader Carries request verification information. This header is used to authenticate the nodes of the message route and check the correctness of transmission.

Message HeadResponse

Field Type Label Description
header Header Carries the requested object header.

Message PutRequest

Field Type Label Description
init PutRequest.Init Carries the initialization parameters of the object stream.
chunk bytes Carries part of the object payload.
meta_header service.RequestMetaHeader Carries request meta information. Header data is used only to regulate message transport and does not affect request execution.
verify_header service.RequestVerificationHeader Carries request verification information. This header is used to authenticate the nodes of the message route and check the correctness of transmission.

Message PutRequest.Init

Groups initialization parameters of object placement in NeoFS.

Field Type Label Description
header Header Carries the header of the object to save in the system.
copies_number uint32 Carries the number of the object copies to store within the RPC call. Default zero value is processed according to the container placement rules.

Message PutResponse

Field Type Label Description
object_id refs.ObjectID Carries identifier of the saved object. It is used to access an object in the container.

Message Range

Range groups the parameters of object payload range.

Field Type Label Description
offset uint64 Carries the offset of the range from the object payload start.
length uint64 Carries the length of the object payload range.

Message SearchRequest

Field Type Label Description
container_id refs.ContainerID Carries search container identifier.
query SearchRequest.Query
meta_header service.RequestMetaHeader Carries request meta information. Header data is used only to regulate message transport and does not affect request execution.
verify_header service.RequestVerificationHeader Carries request verification information. This header is used to authenticate the nodes of the message route and check the correctness of transmission.

Message SearchRequest.Query

Field Type Label Description
version uint32
filters SearchRequest.Query.Filter repeated

Message SearchRequest.Query.Filter

Field Type Label Description
match_type SearchRequest.Query.Filter.MatchType
name string
value string

Message SearchResponse

Field Type Label Description
id_list refs.ObjectID repeated Carries list of object identifiers that match the search query.

SearchRequest.Query.Filter.MatchType

Name Number Description
MATCH_UNKNOWN 0
STRING_EQUAL 1

Top

object/types.proto

Message Header

Header groups the information about the NeoFS object.

Field Type Label Description
main Header.Main Main carries the main part of the header. Main MUST NOT be NULL.
extended Header.Extended Extended carries the additional part of the header.

Message Header.Extended

Extended groups additional information about the object. It encapsulates both user and system attributes needed to regulate the NeoFS sub-systems.

Field Type Label Description
integrity Header.Extended.Integrity integrity carries object integrity evidence.
attributes Header.Extended.Attribute repeated attributes carries list of the object attributes in a string key-value format.
creation_epoch uint64 creation_epoch carries number of NeoFS epoch on which the object was created.
tombstone Header.Extended.Tombstone Tombstone marks the object to be deleted.
homomorphic_hash bytes homomorphic_hash carries homomorphic hash of the object payload.
storage_group Header.Extended.StorageGroup StorageGroup marks an object containing information about a storage group.
split Header.Extended.Split Split carries the position of the object in the split hierarchy.

Message Header.Extended.Attribute

Attribute groups the parameters of the object attributes.

Field Type Label Description
key string key carries the string key to the object attribute.
value string value carries the string value of the object attribute.

Message Header.Extended.Integrity

Integrity groups evidence of the integrity of an object's structure.

Field Type Label Description
payload_checksum bytes payload_checksum 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.
header_checksum bytes header_checksum 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. payload_checksum and header_checksum 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 creator_key and checksum_signature.
session_token service.SessionToken session_token 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 creator_key.
creator_key bytes creator_key carries public key of the object creator in a binary format.
checksum_signature bytes checksum_signature carries signature of the structure checksum by the object creator.

Message Header.Extended.Split

Split groups information about spawning the object through a payload splitting.

Field Type Label Description
parent refs.ObjectID Parent carries identifier of the origin object.
previous refs.ObjectID Previous carries identifier of the left split neighbor.
next refs.ObjectID Next carries identifier of the right split neighbor.
children refs.ObjectID repeated Children carries list of identifiers of the objects generated by splitting the current.
origin Header Origin carries the header of the origin object.

Message Header.Extended.StorageGroup

StorageGroup groups meta information about a storage group.

Message Header.Extended.Tombstone

Tombstone groups the options for deleting an object.

Message Header.Main

Main groups mandatory information about the object. Message fields are presented in all NeoFS objects.

Field Type Label Description
payload_length uint64 payload_length carries length of the object payload. Each object has a fixed payload length since it's immutable.
address refs.Address address carries object address in the NeoFS system. It encapsulates the object and the container identifiers.
owner_id refs.OwnerID owner_id carries identifier of the object owner.

Message Object

Object groups the information about the NeoFS object. It consists of payload data with additional service information.

Field Type Label Description
header Header Header carries the object header.
payload bytes Payload carries the object payload bytes.

Scalar Value Types

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