2020-01-30 11:41:24 +00:00
|
|
|
syntax = "proto3";
|
2020-08-04 21:10:51 +00:00
|
|
|
|
2020-08-12 21:43:51 +00:00
|
|
|
package neo.fs.v2.object;
|
2020-08-04 21:10:51 +00:00
|
|
|
|
2020-08-14 18:27:31 +00:00
|
|
|
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object/grpc;object";
|
2021-03-10 10:54:06 +00:00
|
|
|
option csharp_namespace = "Neo.FileStorage.API.Object";
|
2020-01-30 11:41:24 +00:00
|
|
|
|
|
|
|
import "refs/types.proto";
|
2020-08-18 13:49:05 +00:00
|
|
|
import "session/types.proto";
|
2020-01-30 11:41:24 +00:00
|
|
|
|
2020-11-09 20:29:52 +00:00
|
|
|
// Type of the object payload content. Only `REGULAR` type objects can be split,
|
2021-08-25 10:21:10 +00:00
|
|
|
// hence `TOMBSTONE` and `STORAGE_GROUP` payload is limited by maximal object
|
2020-11-09 20:29:52 +00:00
|
|
|
// size.
|
2020-12-08 15:08:32 +00:00
|
|
|
//
|
2021-08-25 10:21:10 +00:00
|
|
|
// String presentation of object type is the same as definition:
|
|
|
|
// * REGULAR
|
|
|
|
// * TOMBSTONE
|
|
|
|
// * STORAGE_GROUP
|
2020-08-11 10:54:58 +00:00
|
|
|
enum ObjectType {
|
|
|
|
// Just a normal object
|
|
|
|
REGULAR = 0;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// Used internally to identify deleted objects
|
|
|
|
TOMBSTONE = 1;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// StorageGroup information
|
2020-08-11 10:54:58 +00:00
|
|
|
STORAGE_GROUP = 2;
|
|
|
|
}
|
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Type of match expression
|
|
|
|
enum MatchType {
|
|
|
|
// Unknown. Not used
|
|
|
|
MATCH_TYPE_UNSPECIFIED = 0;
|
2020-10-19 08:27:05 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Full string match
|
|
|
|
STRING_EQUAL = 1;
|
2021-02-01 17:27:00 +00:00
|
|
|
|
|
|
|
// Full string mismatch
|
|
|
|
STRING_NOT_EQUAL = 2;
|
2021-02-02 08:49:27 +00:00
|
|
|
|
|
|
|
// Lack of key
|
|
|
|
NOT_PRESENT = 3;
|
2021-08-16 07:25:06 +00:00
|
|
|
|
|
|
|
// String prefix match
|
|
|
|
COMMON_PREFIX = 4;
|
2020-08-14 19:04:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Short header fields
|
|
|
|
message ShortHeader {
|
2020-10-15 18:28:19 +00:00
|
|
|
// Object format version. Effectively the version of API library used to
|
2020-12-08 15:08:32 +00:00
|
|
|
// create particular object.
|
2020-10-16 13:17:49 +00:00
|
|
|
neo.fs.v2.refs.Version version = 1 [json_name = "version"];
|
2020-08-14 19:04:56 +00:00
|
|
|
|
|
|
|
// Epoch when the object was created
|
2020-10-16 13:17:49 +00:00
|
|
|
uint64 creation_epoch = 2 [json_name = "creationEpoch"];
|
2020-08-14 19:04:56 +00:00
|
|
|
|
|
|
|
// Object's owner
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.refs.OwnerID owner_id = 3 [json_name = "ownerID"];
|
2020-08-14 19:04:56 +00:00
|
|
|
|
|
|
|
// Type of the object payload content
|
2020-10-19 08:27:05 +00:00
|
|
|
ObjectType object_type = 4 [json_name = "objectType"];
|
2020-08-14 19:04:56 +00:00
|
|
|
|
|
|
|
// Size of payload in bytes.
|
2020-10-15 18:28:19 +00:00
|
|
|
// `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown
|
2020-10-19 08:27:05 +00:00
|
|
|
uint64 payload_length = 5 [json_name = "payloadLength"];
|
2020-12-17 07:53:40 +00:00
|
|
|
|
|
|
|
// Hash of payload bytes
|
|
|
|
neo.fs.v2.refs.Checksum payload_hash = 6 [json_name = "payloadHash"];
|
|
|
|
|
|
|
|
// Homomorphic hash of the object payload
|
|
|
|
neo.fs.v2.refs.Checksum homomorphic_hash = 7 [json_name = "homomorphicHash"];
|
2020-08-14 19:04:56 +00:00
|
|
|
}
|
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// Object Header
|
2020-08-04 20:43:33 +00:00
|
|
|
message Header {
|
2020-10-15 18:28:19 +00:00
|
|
|
// Object format version. Effectively the version of API library used to
|
|
|
|
// create particular object
|
2020-10-16 13:17:49 +00:00
|
|
|
neo.fs.v2.refs.Version version = 1 [json_name = "version"];
|
2020-08-14 19:44:32 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// Object's container
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.refs.ContainerID container_id = 2 [json_name = "containerID"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// Object's owner
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.refs.OwnerID owner_id = 3 [json_name = "ownerID"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:44:32 +00:00
|
|
|
// Object creation Epoch
|
2020-10-16 13:17:49 +00:00
|
|
|
uint64 creation_epoch = 4 [json_name = "creationEpoch"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// Size of payload in bytes.
|
2020-12-08 15:08:32 +00:00
|
|
|
// `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown.
|
2020-10-19 08:27:05 +00:00
|
|
|
uint64 payload_length = 5 [json_name = "payloadLength"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// Hash of payload bytes
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.refs.Checksum payload_hash = 6 [json_name = "payloadHash"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// Type of the object payload content
|
2020-10-19 08:27:05 +00:00
|
|
|
ObjectType object_type = 7 [json_name = "objectType"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-12-08 15:08:32 +00:00
|
|
|
// Homomorphic hash of the object payload
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.refs.Checksum homomorphic_hash = 8 [json_name = "homomorphicHash"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// Session token, if it was used during Object creation. Need it to verify
|
|
|
|
// integrity and authenticity out of Request scope.
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.session.SessionToken session_token = 9 [json_name = "sessionToken"];
|
2020-08-11 10:54:58 +00:00
|
|
|
|
2020-10-13 15:29:09 +00:00
|
|
|
// `Attribute` is a user-defined Key-Value metadata pair attached to the
|
|
|
|
// object.
|
|
|
|
//
|
2020-12-11 06:46:00 +00:00
|
|
|
// Key name must be a object-unique valid UTF-8 string. Value can't be empty.
|
|
|
|
// Objects with duplicated attribute names or attributes with empty values
|
|
|
|
// will be considered invalid.
|
2020-12-08 10:48:51 +00:00
|
|
|
//
|
2020-10-13 15:29:09 +00:00
|
|
|
// There are some "well-known" attributes starting with `__NEOFS__` prefix
|
|
|
|
// that affect system behaviour:
|
|
|
|
//
|
2020-10-20 20:09:51 +00:00
|
|
|
// * __NEOFS__UPLOAD_ID \
|
|
|
|
// Marks smaller parts of a split bigger object
|
|
|
|
// * __NEOFS__EXPIRATION_EPOCH \
|
|
|
|
// Tells GC to delete object after that epoch
|
|
|
|
//
|
|
|
|
// And some well-known attributes used by applications only:
|
|
|
|
//
|
|
|
|
// * Name \
|
|
|
|
// Human-friendly name
|
|
|
|
// * FileName \
|
|
|
|
// File name to be associated with the object on saving
|
|
|
|
// * Timestamp \
|
|
|
|
// User-defined local time of object creation in Unix Timestamp format
|
2021-03-12 19:25:00 +00:00
|
|
|
// * Content-Type \
|
|
|
|
// MIME Content Type of object's payload
|
2020-10-13 15:29:09 +00:00
|
|
|
//
|
|
|
|
// For detailed description of each well-known attribute please see the
|
|
|
|
// corresponding section in NeoFS Technical specification.
|
2020-08-11 10:54:58 +00:00
|
|
|
message Attribute {
|
|
|
|
// string key to the object attribute
|
2020-10-16 13:17:49 +00:00
|
|
|
string key = 1 [json_name = "key"];
|
2020-08-11 10:54:58 +00:00
|
|
|
// string value of the object attribute
|
2020-10-16 13:17:49 +00:00
|
|
|
string value = 2 [json_name = "value"];
|
2020-08-11 09:03:50 +00:00
|
|
|
}
|
2020-08-12 21:43:51 +00:00
|
|
|
// User-defined object attributes
|
2020-10-16 13:17:49 +00:00
|
|
|
repeated Attribute attributes = 10 [json_name = "attributes"];
|
2020-08-11 10:54:58 +00:00
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// Bigger objects can be split into a chain of smaller objects. Information
|
|
|
|
// about inter-dependencies between spawned objects and how to re-construct
|
|
|
|
// the original one is in the `Split` headers. Parent and children objects
|
|
|
|
// must be within the same container.
|
2020-08-11 10:54:58 +00:00
|
|
|
message Split {
|
2020-10-15 18:28:19 +00:00
|
|
|
// Identifier of the origin object. Known only to the minor child.
|
2020-10-16 13:17:49 +00:00
|
|
|
neo.fs.v2.refs.ObjectID parent = 1 [json_name = "parent"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// Identifier of the left split neighbor
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.refs.ObjectID previous = 2 [json_name = "previous"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// `signature` field of the parent object. Used to reconstruct parent.
|
2020-10-21 16:46:26 +00:00
|
|
|
neo.fs.v2.refs.Signature parent_signature = 3 [json_name = "parentSignature"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// `header` field of the parent object. Used to reconstruct parent.
|
2020-10-19 08:27:05 +00:00
|
|
|
Header parent_header = 4 [json_name = "parentHeader"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// List of identifiers of the objects generated by splitting current one.
|
2020-10-16 13:17:49 +00:00
|
|
|
repeated neo.fs.v2.refs.ObjectID children = 5 [json_name = "children"];
|
2020-11-17 06:37:12 +00:00
|
|
|
|
2020-12-08 15:08:32 +00:00
|
|
|
// 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.
|
2020-11-17 06:37:12 +00:00
|
|
|
bytes split_id = 6 [json_name = "splitID"];
|
|
|
|
|
2020-08-11 09:03:50 +00:00
|
|
|
}
|
2020-10-15 18:28:19 +00:00
|
|
|
// Position of the object in the split hierarchy
|
2020-10-19 08:27:05 +00:00
|
|
|
Split split = 11 [json_name = "split"];
|
2020-08-04 10:18:38 +00:00
|
|
|
}
|
|
|
|
|
2020-10-15 18:28:19 +00:00
|
|
|
// 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.
|
2020-08-04 10:18:38 +00:00
|
|
|
message Object {
|
2020-08-11 10:54:58 +00:00
|
|
|
// Object's unique identifier.
|
2020-10-19 08:27:05 +00:00
|
|
|
neo.fs.v2.refs.ObjectID object_id = 1 [json_name = "objectID"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// Signed object_id
|
2020-10-16 13:17:49 +00:00
|
|
|
neo.fs.v2.refs.Signature signature = 2 [json_name = "signature"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-11 10:54:58 +00:00
|
|
|
// Object metadata headers
|
2020-10-16 13:17:49 +00:00
|
|
|
Header header = 3 [json_name = "header"];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-12-08 15:08:32 +00:00
|
|
|
// Payload bytes
|
2020-10-16 13:17:49 +00:00
|
|
|
bytes payload = 4 [json_name = "payload"];
|
2020-01-30 11:41:24 +00:00
|
|
|
}
|
2020-12-02 08:33:15 +00:00
|
|
|
|
|
|
|
// Meta information of split hierarchy for object assembly. With last part
|
|
|
|
// one can traverse linked list of split hierarchy back to first part and
|
|
|
|
// assemble original object. With linking object one can assembly object
|
|
|
|
// straight away from the object parts.
|
|
|
|
message SplitInfo {
|
|
|
|
// 16 byte UUID used to identify the split object hierarchy parts.
|
|
|
|
bytes split_id = 1;
|
|
|
|
|
|
|
|
// Identifier of the last object in split hierarchy parts. It contains
|
|
|
|
// split header with original object header.
|
|
|
|
neo.fs.v2.refs.ObjectID last_part = 2;
|
|
|
|
|
|
|
|
// Identifier of linking object for split hierarchy parts. It contains
|
|
|
|
// split header with original object header and sorted list of
|
|
|
|
// object parts.
|
|
|
|
neo.fs.v2.refs.ObjectID link = 3;
|
|
|
|
}
|