[#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 <leonard@nspcc.ru>
remotes/KirillovDenis/master
Leonard Lyubich 2021-11-22 13:32:36 +03:00 committed by LeL
parent 5d99e697aa
commit dfb780a2b6
1 changed files with 2 additions and 0 deletions

View File

@ -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.
//