Skip to content

Commit

Permalink
[nspcc-dev#356] netmap: Document IterateSubnets behavior with dupli…
Browse files Browse the repository at this point in the history
…cate 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 <[email protected]>
  • Loading branch information
Leonard Lyubich committed Nov 22, 2021
1 parent 5684a88 commit 0483dc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions netmap/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down

0 comments on commit 0483dc0

Please sign in to comment.