forked from TrueCloudLab/frostfs-node
[#1689] network,core/netmap: Replace Iterate*() functions with iterators
Change-Id: I4842a3160d74c56d99ea9465d4be2f0662080605 Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
e65d578ba9
commit
2d1232ce6d
6 changed files with 33 additions and 27 deletions
|
@ -1,6 +1,10 @@
|
|||
package netmap
|
||||
|
||||
import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
import (
|
||||
"iter"
|
||||
|
||||
"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
|
||||
|
@ -14,8 +18,14 @@ func (x Node) PublicKey() []byte {
|
|||
return (netmap.NodeInfo)(x).PublicKey()
|
||||
}
|
||||
|
||||
// Addresses returns an iterator over all announced network addresses.
|
||||
func (x Node) Addresses() iter.Seq[string] {
|
||||
return (netmap.NodeInfo)(x).NetworkEndpoints()
|
||||
}
|
||||
|
||||
// IterateAddresses iterates over all announced network addresses
|
||||
// and passes them into f. Handler MUST NOT be nil.
|
||||
// Deprecated: use [Node.Addresses] instead.
|
||||
func (x Node) IterateAddresses(f func(string) bool) {
|
||||
for s := range (netmap.NodeInfo)(x).NetworkEndpoints() {
|
||||
if f(s) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue