frostfs-node/pkg/core/netmap/nodes.go
Evgenii Stratonikov bf06c4fb4b
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m25s
Build / Build Components (push) Successful in 1m48s
Pre-commit hooks / Pre-commit (push) Successful in 1m56s
Tests and linters / Run gofumpt (push) Successful in 3m48s
Tests and linters / Lint (push) Successful in 4m14s
Tests and linters / Staticcheck (push) Successful in 4m10s
Tests and linters / gopls check (push) Successful in 4m23s
Tests and linters / Tests (push) Successful in 4m33s
OCI image / Build container images (push) Successful in 5m3s
Tests and linters / Tests with -race (push) Successful in 5m20s
[#1689] Remove deprecated NodeInfo.IterateNetworkEndpoints()
Change-Id: Ic78f18aed11fab34ee3147ceea657296b89fe60c
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-04-15 14:47:22 +00:00

40 lines
1.3 KiB
Go

package netmap
import "git.frostfs.info/TrueCloudLab/frostfs-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) {
for s := range (netmap.NodeInfo)(x).NetworkEndpoints() {
if f(s) {
return
}
}
}
// NumberOfAddresses returns number of announced network addresses.
func (x Node) NumberOfAddresses() int {
return (netmap.NodeInfo)(x).NumberOfNetworkEndpoints()
}
// ExternalAddresses returns external addresses of a node.
func (x Node) ExternalAddresses() []string {
return (netmap.NodeInfo)(x).ExternalAddresses()
}
// 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