From 8b1c8eb6898cc3b1bda7a616f4ed98cf8b7123fd Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Jun 2021 13:39:00 +0300 Subject: [PATCH] [#86] netmap: Add netmap candidate list getter With `NetmapCandidate` storage nodes can monitor if they are expected to be in the netmap at next epoch or not. This is also important for monitoring when some nodes does not bootstrap immediately. Signed-off-by: Alex Vanin --- netmap/config.yml | 2 +- netmap/netmap_contract.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/netmap/config.yml b/netmap/config.yml index bf48768..e6a48b1 100644 --- a/netmap/config.yml +++ b/netmap/config.yml @@ -1,5 +1,5 @@ name: "NeoFS Netmap" -safemethods: ["innerRingList", "epoch", "netmap", "snapshot", "snapshotByEpoch", "config", "listConfig", "version"] +safemethods: ["innerRingList", "epoch", "netmap", "netmapCandidates", "snapshot", "snapshotByEpoch", "config", "listConfig", "version"] events: - name: AddPeer parameters: diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index 2a83d48..b2a3053 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -351,6 +351,13 @@ func Netmap() []storageNode { return getSnapshot(ctx, snapshot0Key) } +// NetmapCandidates returns all node candidates for next epoch and their +// status codes. +func NetmapCandidates() []netmapNode { + ctx := storage.GetReadOnlyContext() + return getNetmapNodes(ctx) +} + func Snapshot(diff int) []storageNode { var key string