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
|
@ -2,6 +2,7 @@ package network
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"iter"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
)
|
||||
|
@ -34,12 +35,8 @@ var (
|
|||
// MultiAddressIterator.
|
||||
type NodeEndpointsIterator netmap.NodeInfo
|
||||
|
||||
func (x NodeEndpointsIterator) IterateAddresses(f func(string) bool) {
|
||||
for s := range (netmap.NodeInfo)(x).NetworkEndpoints() {
|
||||
if f(s) {
|
||||
return
|
||||
}
|
||||
}
|
||||
func (x NodeEndpointsIterator) Addresses() iter.Seq[string] {
|
||||
return (netmap.NodeInfo)(x).NetworkEndpoints()
|
||||
}
|
||||
|
||||
func (x NodeEndpointsIterator) NumberOfAddresses() int {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue