forked from TrueCloudLab/frostfs-node
[#607] network: Make AddressGroup.WriteToNodeInfo
method a function
Method implementation doesn't use any private logic. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
359bbe319a
commit
119031c8c7
2 changed files with 9 additions and 6 deletions
|
@ -107,12 +107,14 @@ func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) {
|
|||
}
|
||||
|
||||
// WriteToNodeInfo writes AddressGroup to netmap.NodeInfo structure.
|
||||
func (x AddressGroup) WriteToNodeInfo(ni *netmap.NodeInfo) {
|
||||
addrs := make([]string, len(x))
|
||||
func WriteToNodeInfo(g AddressGroup, ni *netmap.NodeInfo) {
|
||||
num := g.Len()
|
||||
addrs := make([]string, 0, num)
|
||||
|
||||
for i := range x {
|
||||
addrs[i] = x[i].String()
|
||||
}
|
||||
g.IterateAddresses(func(addr Address) bool {
|
||||
addrs = append(addrs, addr.String())
|
||||
return false
|
||||
})
|
||||
|
||||
ni.SetAddresses(addrs...)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue