frostfs-node/pkg/core/netmap/nodes.go
Leonard Lyubich 21d2f8f861 [#1513] Upgrade NeoFS SDK Go with changed netmap package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-06-17 15:53:18 +03:00

31 lines
1.1 KiB
Go

package netmap
import "github.com/nspcc-dev/neofs-sdk-go/netmap"
// Node is a named type of netmap.NodeInfo which provides interface needed
// in the current repository. Node is expected to be used everywhere instead
// of direct usage of netmap.NodeInfo, so it represents a type mediator.
type Node netmap.NodeInfo
// PublicKey returns public key bound to the storage node.
//
// Return value MUST NOT be mutated, make a copy first.
func (x Node) PublicKey() []byte {
return (netmap.NodeInfo)(x).PublicKey()
}
// IterateAddresses iterates over all announced network addresses
// and passes them into f. Handler MUST NOT be nil.
func (x Node) IterateAddresses(f func(string) bool) {
(netmap.NodeInfo)(x).IterateNetworkEndpoints(f)
}
// NumberOfAddresses returns number of announced network addresses.
func (x Node) NumberOfAddresses() int {
return (netmap.NodeInfo)(x).NumberOfNetworkEndpoints()
}
// Nodes is a named type of []netmap.NodeInfo which provides interface needed
// in the current repository. Nodes is expected to be used everywhere instead
// of direct usage of []netmap.NodeInfo, so it represents a type mediator.
type Nodes []netmap.NodeInfo