[#34] bootstrap: Define node state enum in NodeInfo

Replaces Status field of NodeInfo with State field value of NodeInfo.State
enumeration.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-08-05 22:29:11 +03:00 committed by Stanislav Bogatyrev
parent c88d1fdae3
commit 7c71813d22
2 changed files with 22 additions and 3 deletions

View file

@ -24,6 +24,12 @@ message NodeInfo {
bytes PubKey = 2 [(gogoproto.jsontag) = "pubkey,omitempty"]; bytes PubKey = 2 [(gogoproto.jsontag) = "pubkey,omitempty"];
// Options is set of node optional information, such as storage capacity, node location, price and etc // Options is set of node optional information, such as storage capacity, node location, price and etc
repeated string Options = 3 [(gogoproto.jsontag) = "options,omitempty"]; repeated string Options = 3 [(gogoproto.jsontag) = "options,omitempty"];
// Status is bitmap status of the node
uint64 Status = 4 [(gogoproto.jsontag) = "status", (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeStatus"]; enum State {
Unknown = 0;
Online = 1;
Offline = 2;
}
State state = 4;
} }

View file

@ -105,7 +105,7 @@ Node state
| Address | [string](#string) | | Address is a node [multi-address](https://github.com/multiformats/multiaddr) | | Address | [string](#string) | | Address is a node [multi-address](https://github.com/multiformats/multiaddr) |
| PubKey | [bytes](#bytes) | | PubKey is a compressed public key representation in bytes | | PubKey | [bytes](#bytes) | | PubKey is a compressed public key representation in bytes |
| Options | [string](#string) | repeated | Options is set of node optional information, such as storage capacity, node location, price and etc | | Options | [string](#string) | repeated | Options is set of node optional information, such as storage capacity, node location, price and etc |
| Status | [uint64](#uint64) | | Status is bitmap status of the node | | state | [NodeInfo.State](#bootstrap.NodeInfo.State) | | |
<a name="bootstrap.SpreadMap"></a> <a name="bootstrap.SpreadMap"></a>
@ -121,6 +121,19 @@ Node state
<!-- end messages --> <!-- end messages -->
<a name="bootstrap.NodeInfo.State"></a>
### NodeInfo.State
| Name | Number | Description |
| ---- | ------ | ----------- |
| Unknown | 0 | |
| Online | 1 | |
| Offline | 2 | |
<!-- end enums --> <!-- end enums -->