frostfs-api/netmap/types.proto
Stanislav Bogatyrev ea61d4e0e9 [#68] Add SAME|DISTINCT selector clause
Helps to define how selection is formed

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
2020-09-07 18:31:31 +03:00

153 lines
3.4 KiB
Protocol Buffer

syntax = "proto3";
package neo.fs.v2.netmap;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc;netmap";
option csharp_namespace = "NeoFS.API.v2.Netmap";
// Operations on filters
enum Operation {
// No Operation defined
OPERATION_UNSPECIFIED = 0;
// Equal
EQ = 1;
// Not Equal
NE = 2;
// Greater then
GT = 3;
// Greater or equal
GE = 4;
// Less then
LT = 5;
// Less or equal
LE = 6;
// Logical OR
OR = 7;
// Logical AND
AND = 8;
}
// Selector modifier showing how the node set will be formed
// By default selector just groups by attribute into a bucket selecting nodes
// only by their hash distance.
enum Clause{
// No modifier defined. Will select nodes from bucket randomly.
CLAUSE_UNSPECIFIED = 0;
// SAME will select only nodes having the same value of bucket attribute
SAME = 1;
// DISTINCT will select nodes having different values of bucket attribute
DISTINCT = 2;
}
// Filter
message Filter {
// Name of the filter or a reference to the named filter.
// '*' means application to the whole unfiltered NetworkMap
// At top level it's used as a filter name. At lower levels it's considered to
// be a reference to another named filter
string name = 1;
// Key to filter
string key = 2;
// Filtering operation
Operation op = 3;
// Value to match
string value = 4;
// List of inner filters. Top level operation will be applied to the whole list.
repeated Filter filters = 5;
}
// Selector
message Selector {
// Selector name to reference in object placement section
string name = 1;
// How many nodes to select from bucket
uint32 count = 2;
// Selector modifier showing how to form a bucket
Clause clause = 3;
// Attribute bucket to select from
string attribute = 4;
// Filter reference to select from
string filter = 5;
}
// Exact bucket for each replica
message Replica {
// How many object replicas to put
uint32 count = 1;
// Named selector bucket to put in
string selector = 2;
}
// Set of rules to select a subset of nodes able to store container's objects
message PlacementPolicy {
// Rules to set number of object replicas and place each one into a particular bucket
repeated Replica replicas = 1;
// Container backup factor controls how deep NeoFS will search for nodes
// alternatives to include into container.
uint32 container_backup_factor = 2;
// Set of Selectors to form the container's nodes subset
repeated Selector selectors = 3;
// List of named filters to reference in selectors
repeated Filter filters = 4;
}
// NeoFS node description
message NodeInfo {
// Public key of the NeoFS node in a binary format.
bytes public_key = 1;
// Ways to connect to a node
string address = 2;
// Attributes of the NeoFS node.
message Attribute {
// Key of the node attribute.
string key = 1;
// Value of the node attribute.
string value = 2;
// Parent keys, if any
// Example: For City it can be Region or Country
repeated string parents = 3;
}
// Carries list of the NeoFS node attributes in a string key-value format.
repeated Attribute attributes = 3;
// Represents the enumeration of various states of the NeoFS node.
enum State {
// Unknown state.
UNSPECIFIED = 0;
// Active state in the network.
ONLINE = 1;
// Network unavailable state.
OFFLINE = 2;
}
// Carries state of the NeoFS node.
State state = 4;
}