frostfs-api/netmap/types.proto
Stanislav Bogatyrev c8054c5daa [] netmap: Simplify Placement Policy
Proposed protobuf format for Placement Policy simplifies direct editing in
visual editors and import/export from other formats like JSON.

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
2020-09-01 21:15:09 +03:00

136 lines
2.9 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;
}
// 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;
// Attribute bucket to select from
string attribute = 3;
// Filter reference to select from
string filter = 4;
}
// 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;
}