From dfb780a2b628f7036251be7028c59cdbd47652d4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 22 Nov 2021 13:32:36 +0300 Subject: [PATCH] [#356] netmap: Document `IterateSubnets` behavior with duplicate keys Node attributes must be key-unique. In current implementation `IterateSubnets` doesn't monitor the uniqueness of keys. Declare undefined behavior of `IterateSubnets` for non-unique attribute keys. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netmap/attributes.go b/netmap/attributes.go index ff01a0d9..47dbc5cf 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -118,6 +118,8 @@ var errNoSubnets = errors.New("no subnets") // IterateSubnets iterates over all subnets the node belongs to and passes the IDs to f. // Handler must not be nil. // +// Subnet attributes are expected to be key-unique, otherwise undefined behavior. +// // If f returns ErrRemoveSubnet, then removes subnet entry. Note that this leads to an instant mutation of NodeInfo. // Breaks on any other non-nil error and returns it. //