[#73] Add JSON field names to netmap package

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Stanislav Bogatyrev 2020-10-19 11:24:58 +03:00 committed by Stanislav Bogatyrev
parent d0d74c3a2f
commit 6ea8bc3214

View file

@ -56,39 +56,39 @@ message Filter {
// application to the whole unfiltered NetworkMap. At top level it's used as a // 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 // filter name. At lower levels it's considered to be a reference to another
// named filter // named filter
string name = 1; string name = 1 [json_name = "name"];
// Key to filter // Key to filter
string key = 2; string key = 2 [json_name = "key"];
// Filtering operation // Filtering operation
Operation op = 3; Operation op = 3 [json_name = "op"];
// Value to match // Value to match
string value = 4; string value = 4 [json_name = "value"];
// List of inner filters. Top level operation will be applied to the whole // List of inner filters. Top level operation will be applied to the whole
// list. // list.
repeated Filter filters = 5; repeated Filter filters = 5 [json_name = "filters"];
} }
// Selector chooses a number of nodes from the bucket taking the nearest nodes // Selector chooses a number of nodes from the bucket taking the nearest nodes
// to the provided `ContainerID` by hash distance. // to the provided `ContainerID` by hash distance.
message Selector { message Selector {
// Selector name to reference in object placement section // Selector name to reference in object placement section
string name = 1; string name = 1 [json_name = "name"];
// How many nodes to select from the bucket // How many nodes to select from the bucket
uint32 count = 2; uint32 count = 2 [json_name = "count"];
// Selector modifier showing how to form a bucket // Selector modifier showing how to form a bucket
Clause clause = 3; Clause clause = 3 [json_name = "clause"];
// Attribute bucket to select from // Attribute bucket to select from
string attribute = 4; string attribute = 4 [json_name = "attribute"];
// Filter reference to select from // Filter reference to select from
string filter = 5; string filter = 5 [json_name = "filter"];
} }
// Number of object replicas in a set of nodes from the defined selector. If no // Number of object replicas in a set of nodes from the defined selector. If no
@ -96,10 +96,10 @@ message Selector {
// default. // default.
message Replica { message Replica {
// How many object replicas to put // How many object replicas to put
uint32 count = 1; uint32 count = 1 [json_name = "count"];
// Named selector bucket to put replicas // Named selector bucket to put replicas
string selector = 2; string selector = 2 [json_name = "selector"];
} }
// Set of rules to select a subset of nodes from `NetworkMap` able to store // Set of rules to select a subset of nodes from `NetworkMap` able to store
@ -108,26 +108,26 @@ message Replica {
message PlacementPolicy { message PlacementPolicy {
// Rules to set number of object replicas and place each one into a named // Rules to set number of object replicas and place each one into a named
// bucket // bucket
repeated Replica replicas = 1; repeated Replica replicas = 1 [json_name = "replicas"];
// Container backup factor controls how deep NeoFS will search for nodes // Container backup factor controls how deep NeoFS will search for nodes
// alternatives to include into container's nodes subset // alternatives to include into container's nodes subset
uint32 container_backup_factor = 2; uint32 container_backup_factor = 2 [json_name = "containerBackupFactor"];
// Set of Selectors to form the container's nodes subset // Set of Selectors to form the container's nodes subset
repeated Selector selectors = 3; repeated Selector selectors = 3 [json_name = "selectors"];
// List of named filters to reference in selectors // List of named filters to reference in selectors
repeated Filter filters = 4; repeated Filter filters = 4 [json_name = "filters"];
} }
// NeoFS node description // NeoFS node description
message NodeInfo { message NodeInfo {
// Public key of the NeoFS node in a binary format. // Public key of the NeoFS node in a binary format.
bytes public_key = 1; bytes public_key = 1 [json_name = "publicKey"];
// Ways to connect to a node // Ways to connect to a node
string address = 2; string address = 2 [json_name = "address"];
// Administrator-defined Attributes of the NeoFS Storage Node. // Administrator-defined Attributes of the NeoFS Storage Node.
// //
@ -167,17 +167,17 @@ message NodeInfo {
// corresponding section in NeoFS Technical specification. // corresponding section in NeoFS Technical specification.
message Attribute { message Attribute {
// Key of the node attribute. // Key of the node attribute.
string key = 1; string key = 1 [json_name = "key"];
// Value of the node attribute. // Value of the node attribute.
string value = 2; string value = 2 [json_name = "value"];
// Parent keys, if any. For example for `City` it could be `Region` and // Parent keys, if any. For example for `City` it could be `Region` and
// `Country`. // `Country`.
repeated string parents = 3; repeated string parents = 3 [json_name = "parents"];
} }
// Carries list of the NeoFS node attributes in a string key-value format. // Carries list of the NeoFS node attributes in a string key-value format.
repeated Attribute attributes = 3; repeated Attribute attributes = 3 [json_name = "attributes"];
// Represents the enumeration of various states of the NeoFS node. // Represents the enumeration of various states of the NeoFS node.
enum State { enum State {
@ -192,5 +192,5 @@ message NodeInfo {
} }
// Carries state of the NeoFS node. // Carries state of the NeoFS node.
State state = 4; State state = 4 [json_name = "state"];
} }