2022-05-19 11:53:16 +00:00
|
|
|
/**
|
|
|
|
* Service for working with CRDT tree.
|
|
|
|
*/
|
2022-04-22 13:30:20 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package tree;
|
|
|
|
|
|
|
|
import "pkg/services/tree/types.proto";
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree";
|
2022-04-22 13:30:20 +00:00
|
|
|
|
|
|
|
service TreeService {
|
|
|
|
/* Client API */
|
|
|
|
|
2022-09-12 11:10:32 +00:00
|
|
|
// Client methods are mapped to the object RPC:
|
|
|
|
// [ Add, AddByPath, Remove, Move ] -> PUT;
|
|
|
|
// [ GetNodeByPath, GetSubTree ] -> GET.
|
|
|
|
// One of the following must be true:
|
|
|
|
// - a signer passes non-extended basic ACL;
|
|
|
|
// - a signer passes extended basic ACL AND bearer token is
|
|
|
|
// attached AND the basic ACL allows attaching bearer token
|
|
|
|
// to the GET/PUT operation AND eACL table in the bearer contains
|
|
|
|
// an explicit allowing the signer's key (or its role) rule
|
|
|
|
// for the GET/PUT operation;
|
|
|
|
// - a signer passes extended basic ACL AND the extension
|
|
|
|
// contains an explicit allowing the signer's key (or its role)
|
|
|
|
// rule for GET/PUT operation.
|
|
|
|
// Otherwise, a request is denied.
|
|
|
|
|
2022-04-22 13:30:20 +00:00
|
|
|
// Add adds new node to the tree. Invoked by a client.
|
|
|
|
rpc Add (AddRequest) returns (AddResponse);
|
|
|
|
// AddByPath adds new node to the tree by path. Invoked by a client.
|
|
|
|
rpc AddByPath (AddByPathRequest) returns (AddByPathResponse);
|
|
|
|
// Remove removes node from the tree. Invoked by a client.
|
|
|
|
rpc Remove (RemoveRequest) returns (RemoveResponse);
|
|
|
|
// Move moves node from one parent to another. Invoked by a client.
|
|
|
|
rpc Move (MoveRequest) returns (MoveResponse);
|
|
|
|
// GetNodeByPath returns list of IDs corresponding to a specific filepath.
|
|
|
|
rpc GetNodeByPath (GetNodeByPathRequest) returns (GetNodeByPathResponse);
|
|
|
|
// GetSubTree returns tree corresponding to a specific node.
|
2022-04-29 10:06:10 +00:00
|
|
|
rpc GetSubTree (GetSubTreeRequest) returns (stream GetSubTreeResponse);
|
2022-10-18 13:03:03 +00:00
|
|
|
// TreeList return list of the existing trees in the container.
|
|
|
|
rpc TreeList (TreeListRequest) returns (TreeListResponse);
|
2022-04-22 13:30:20 +00:00
|
|
|
|
|
|
|
/* Synchronization API */
|
|
|
|
|
|
|
|
// Apply pushes log operation from another node to the current.
|
|
|
|
// The request must be signed by a container node.
|
|
|
|
rpc Apply (ApplyRequest) returns (ApplyResponse);
|
2022-05-19 11:53:16 +00:00
|
|
|
// GetOpLog returns a stream of logged operations starting from some height.
|
2022-05-11 13:29:04 +00:00
|
|
|
rpc GetOpLog(GetOpLogRequest) returns (stream GetOpLogResponse);
|
2022-10-10 11:33:17 +00:00
|
|
|
// Healthcheck is a dummy rpc to check service availability
|
|
|
|
rpc Healthcheck(HealthcheckRequest) returns (HealthcheckResponse);
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message AddRequest {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-04-22 13:30:20 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-04-22 13:30:20 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the parent to attach node to.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 parent_id = 3;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Key-Value pairs with meta information.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated KeyValue meta = 4;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Bearer token in V2 format.
|
2022-05-05 11:00:30 +00:00
|
|
|
bytes bearer_token = 5;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message AddResponse {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the created node.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 node_id = 1;
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
message AddByPathRequest {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-04-22 13:30:20 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-04-22 13:30:20 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Attribute to build path with. Default: "FileName".
|
2022-04-22 13:30:20 +00:00
|
|
|
string path_attribute = 3;
|
2022-05-19 11:53:16 +00:00
|
|
|
// List of path components.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated string path = 4;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Node meta-information.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated KeyValue meta = 5;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Bearer token in V2 format.
|
2022-05-05 11:00:30 +00:00
|
|
|
bytes bearer_token = 6;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message AddByPathResponse {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// List of all created nodes. The first one is the leaf.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated uint64 nodes = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the parent node where new nodes were attached.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 parent_id = 2;
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
message RemoveRequest {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-04-22 13:30:20 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-04-22 13:30:20 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the node to remove.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 node_id = 3;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Bearer token in V2 format.
|
2022-05-05 11:00:30 +00:00
|
|
|
bytes bearer_token = 4;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RemoveResponse {
|
|
|
|
message Body {
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
message MoveRequest {
|
|
|
|
message Body {
|
|
|
|
// TODO import neo.fs.v2.refs.ContainerID directly.
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-04-22 13:30:20 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-04-22 13:30:20 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the new parent.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 parent_id = 3;
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the node to move.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 node_id = 4;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Node meta-information.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated KeyValue meta = 5;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Bearer token in V2 format.
|
2022-05-05 11:00:30 +00:00
|
|
|
bytes bearer_token = 6;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message MoveResponse {
|
|
|
|
message Body {
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
message GetNodeByPathRequest {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-04-22 13:30:20 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-04-22 13:30:20 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Attribute to build path with. Default: "FileName".
|
2022-04-22 13:30:20 +00:00
|
|
|
string path_attribute = 3;
|
2022-05-19 11:53:16 +00:00
|
|
|
// List of path components.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated string path = 4;
|
2022-05-19 11:53:16 +00:00
|
|
|
// List of attributes to include in response.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated string attributes = 5;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Flag to return only the latest version of node.
|
2022-04-22 13:30:20 +00:00
|
|
|
bool latest_only = 6;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Flag to return all stored attributes.
|
2022-04-22 13:30:20 +00:00
|
|
|
bool all_attributes = 7;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Bearer token in V2 format.
|
2022-05-05 11:00:30 +00:00
|
|
|
bytes bearer_token = 8;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetNodeByPathResponse {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Information about a single tree node.
|
2022-04-22 13:30:20 +00:00
|
|
|
message Info {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Node ID.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 node_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Timestamp of the last operation with the node.
|
2022-04-22 13:30:20 +00:00
|
|
|
uint64 timestamp = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Node meta-information.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated KeyValue meta = 3;
|
2022-09-05 13:46:56 +00:00
|
|
|
// Parent ID.
|
|
|
|
uint64 parent_id = 4;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// List of nodes stored by path.
|
2022-04-22 13:30:20 +00:00
|
|
|
repeated Info nodes = 1;
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
message GetSubTreeRequest {
|
|
|
|
message Body {
|
2023-07-11 08:39:17 +00:00
|
|
|
message Order {
|
|
|
|
enum Direction {
|
|
|
|
None = 0;
|
|
|
|
Asc = 1;
|
|
|
|
}
|
|
|
|
Direction direction = 1;
|
|
|
|
}
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-04-22 13:30:20 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-04-22 13:30:20 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the root node of a subtree.
|
2022-04-29 10:06:10 +00:00
|
|
|
uint64 root_id = 3;
|
|
|
|
// Optional depth of the traversal. Zero means return only root.
|
|
|
|
// Maximum depth is 10.
|
|
|
|
uint32 depth = 4;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Bearer token in V2 format.
|
2022-05-05 11:00:30 +00:00
|
|
|
bytes bearer_token = 5;
|
2023-07-11 08:39:17 +00:00
|
|
|
// Result ordering.
|
|
|
|
Order order_by = 6;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetSubTreeResponse {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the node.
|
2022-04-29 10:06:10 +00:00
|
|
|
uint64 node_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// ID of the parent.
|
2022-04-29 10:06:10 +00:00
|
|
|
uint64 parent_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Time node was first added to a tree.
|
2022-04-29 10:06:10 +00:00
|
|
|
uint64 timestamp = 3;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Node meta-information.
|
2022-04-29 10:06:10 +00:00
|
|
|
repeated KeyValue meta = 4;
|
2022-04-22 13:30:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
|
|
|
|
2022-10-18 13:03:03 +00:00
|
|
|
message TreeListRequest {
|
|
|
|
message Body {
|
|
|
|
// Container ID in V2 format.
|
|
|
|
bytes container_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Request body.
|
|
|
|
Body body = 1;
|
|
|
|
// Request signature.
|
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TreeListResponse {
|
|
|
|
message Body {
|
|
|
|
// Tree IDs.
|
|
|
|
repeated string ids = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Response body.
|
|
|
|
Body body = 1;
|
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
2022-04-22 13:30:20 +00:00
|
|
|
|
|
|
|
message ApplyRequest {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-04-22 13:30:20 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-04-22 13:30:20 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Operation to be applied.
|
2022-04-22 13:30:20 +00:00
|
|
|
LogMove operation = 3;
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ApplyResponse {
|
|
|
|
message Body {
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-04-22 13:30:20 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-04-22 13:30:20 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
2022-05-11 13:29:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
message GetOpLogRequest {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Container ID in V2 format.
|
2022-05-11 13:29:04 +00:00
|
|
|
bytes container_id = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// The name of the tree.
|
2022-05-11 13:29:04 +00:00
|
|
|
string tree_id = 2;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Starting height to return logs from.
|
2022-05-11 13:29:04 +00:00
|
|
|
uint64 height = 3;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Amount of operations to return.
|
2022-05-11 13:29:04 +00:00
|
|
|
uint64 count = 4;
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request body.
|
2022-05-11 13:29:04 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Request signature.
|
2022-05-11 13:29:04 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetOpLogResponse {
|
|
|
|
message Body {
|
2022-05-19 11:53:16 +00:00
|
|
|
// Operation on a tree.
|
2022-05-11 13:29:04 +00:00
|
|
|
LogMove operation = 1;
|
|
|
|
}
|
|
|
|
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response body.
|
2022-05-11 13:29:04 +00:00
|
|
|
Body body = 1;
|
2022-05-19 11:53:16 +00:00
|
|
|
// Response signature.
|
2022-05-11 13:29:04 +00:00
|
|
|
Signature signature = 2;
|
|
|
|
};
|
2022-10-10 11:33:17 +00:00
|
|
|
|
|
|
|
message HealthcheckResponse {
|
|
|
|
message Body {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Response body.
|
|
|
|
Body body = 1;
|
|
|
|
// Response signature.
|
|
|
|
Signature signature = 2;
|
|
|
|
};
|
|
|
|
|
|
|
|
message HealthcheckRequest {
|
|
|
|
message Body {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Request body.
|
|
|
|
Body body = 1;
|
|
|
|
// Request signature.
|
|
|
|
Signature signature = 2;
|
|
|
|
}
|