From 88023f3655d6c4f1499d904ff49ec4b0889360c0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 14 Jan 2021 18:59:39 +0300 Subject: [PATCH] [#311] services/control: Define Netmap structure Define NodeInfo protobuf type. Define Netmap protobuf type. Signed-off-by: Leonard Lyubich --- pkg/services/control/types.go | 63 +++++++++++++++++++++++++ pkg/services/control/types.pb.go | Bin 10732 -> 33000 bytes pkg/services/control/types.proto | 77 +++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) diff --git a/pkg/services/control/types.go b/pkg/services/control/types.go index 67f9fda38..237cdcc67 100644 --- a/pkg/services/control/types.go +++ b/pkg/services/control/types.go @@ -13,3 +13,66 @@ func (m *Signature) SetSign(v []byte) { m.Sign = v } } + +// SetKey sets key of the node attribute. +func (m *NodeInfo_Attribute) SetKey(v string) { + if m != nil { + m.Key = v + } +} + +// SetValue sets value of the node attribute. +func (m *NodeInfo_Attribute) SetValue(v string) { + if m != nil { + m.Value = v + } +} + +// SetParents sets parent keys. +func (m *NodeInfo_Attribute) SetParents(v []string) { + if m != nil { + m.Parents = v + } +} + +// SetPublicKey sets public key of the NeoFS node in a binary format. +func (m *NodeInfo) SetPublicKey(v []byte) { + if m != nil { + m.PublicKey = v + } +} + +// SetAddress sets ways to connect to a node. +func (m *NodeInfo) SetAddress(v string) { + if m != nil { + m.Address = v + } +} + +// SetAttributes sets attributes of the NeoFS Storage Node. +func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { + if m != nil { + m.Attributes = v + } +} + +// SetState sets state of the NeoFS node. +func (m *NodeInfo) SetState(v HealthStatus) { + if m != nil { + m.State = v + } +} + +// SetEpoch sets revision number of the network map. +func (m *Netmap) SetEpoch(v uint64) { + if m != nil { + m.Epoch = v + } +} + +// SetNodes sets nodes presented in network. +func (m *Netmap) SetNodes(v []*NodeInfo) { + if m != nil { + m.Nodes = v + } +} diff --git a/pkg/services/control/types.pb.go b/pkg/services/control/types.pb.go index a8d7e0be89fe52d9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s}5DGz%~>_a$2zgCjqn) zLGNmtklUK1$qYk-SUqA*v{bMe)U37Q&oC&m=kPjV#pdB}uwDe3P{mD!*y_Eps|?(GtHL7@rCceW> zhtCyTeQSGr569t+-bE{c@8M?iRW{R#y;+{$G;_)`Vcxg)486>3+6o2vb>fGs9 W{C;uz^8WXu(}$1$u1+`W-IM<$oK2|! diff --git a/pkg/services/control/types.proto b/pkg/services/control/types.proto index 4b06a3485..909ba34f9 100644 --- a/pkg/services/control/types.proto +++ b/pkg/services/control/types.proto @@ -24,3 +24,80 @@ enum HealthStatus { // Node is offline. OFFLINE = 2; } + +// NeoFS node description. +message NodeInfo { + // Public key of the NeoFS node in a binary format. + bytes public_key = 1 [json_name = "publicKey"]; + + // Ways to connect to a node. + string address = 2 [json_name = "address"]; + + // Administrator-defined Attributes of the NeoFS Storage Node. + // + // `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 + // string. Value can't be empty. + // + // Node's attributes are mostly used during Storage Policy evaluation to + // calculate object's placement and find a set of nodes satisfying policy + // requirements. There are some "well-known" node attributes common to all the + // Storage Nodes in the network and used implicitly with default values if not + // explicitly set: + // + // * Capacity \ + // Total available disk space in Gigabytes. + // * Price \ + // Price in GAS tokens for storing one GB of data during one Epoch. In node + // attributes it's a string presenting floating point number with comma or + // point delimiter for decimal part. In the Network Map it will be saved as + // 64-bit unsigned integer representing number of minimal token fractions. + // * Subnet \ + // String ID of Node's storage subnet. There can be only one subnet served + // by the Storage Node. + // * Locode \ + // Node's geographic location in + // [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) + // format approximated to the nearest point defined in standard. + // * Country \ + // Country code in + // [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + // format. Calculated automatically from `Locode` attribute + // * Region \ + // Country's administative subdivision where node is located. Calculated + // automatically from `Locode` attribute based on `SubDiv` field. Presented + // in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. + // * City \ + // City, town, village or rural area name where node is located written + // without diacritics . Calculated automatically from `Locode` attribute. + // + // For detailed description of each well-known attribute please see the + // corresponding section in NeoFS Technical specification. + message Attribute { + // Key of the node attribute. + string key = 1 [json_name = "key"]; + + // Value of the node attribute. + string value = 2 [json_name = "value"]; + + // Parent keys, if any. For example for `City` it could be `Region` and + // `Country`. + repeated string parents = 3 [json_name = "parents"]; + } + // Carries list of the NeoFS node attributes in a key-value form. Key name + // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo + // structures with duplicated attribute names or attributes with empty values + // will be considered invalid. + repeated Attribute attributes = 3 [json_name = "attributes"]; + + // Carries state of the NeoFS node. + HealthStatus state = 4 [json_name = "state"]; +} + +// Network map structure. +message Netmap { + // Network map revision number. + uint64 epoch = 1 [json_name = "epoch"]; + + // Nodes presented in network. + repeated NodeInfo nodes = 2 [json_name = "nodes"]; +} \ No newline at end of file