From 7c71813d226e9229f06d97bf4cac5aec942c2ec4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 5 Aug 2020 22:29:11 +0300 Subject: [PATCH] [#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 --- bootstrap/types.proto | 10 ++++++++-- proto-docs/bootstrap.md | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/bootstrap/types.proto b/bootstrap/types.proto index 4ef0fff..74cd5ed 100644 --- a/bootstrap/types.proto +++ b/bootstrap/types.proto @@ -24,6 +24,12 @@ message NodeInfo { bytes PubKey = 2 [(gogoproto.jsontag) = "pubkey,omitempty"]; // Options is set of node optional information, such as storage capacity, node location, price and etc 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; } diff --git a/proto-docs/bootstrap.md b/proto-docs/bootstrap.md index 80aa109..11b4f23 100644 --- a/proto-docs/bootstrap.md +++ b/proto-docs/bootstrap.md @@ -105,7 +105,7 @@ Node state | 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 | | 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) | | | @@ -121,6 +121,19 @@ Node state + + + +### NodeInfo.State + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| Unknown | 0 | | +| Online | 1 | | +| Offline | 2 | | + +