[#607] placement: Work with AddressGroup

Make `PlacementBuilder` implementations to work `network.AddressGroup` type.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-22 18:27:25 +03:00 committed by Leonard Lyubich
parent b3dd9a3254
commit 9033cf5aa1

View file

@ -50,15 +50,15 @@ func (p *localPlacement) BuildPlacement(addr *object.Address, policy *netmapSDK.
for i := range vs {
for j := range vs[i] {
var addr network.Address
var addr network.AddressGroup
err := addr.FromString(vs[i][j].Address())
err := addr.FromIterator(vs[i][j])
if err != nil {
// TODO: log error
continue
}
if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) {
if network.IsLocalAddress(p.localAddrSrc, addr) {
return []netmapSDK.Nodes{{vs[i][j]}}, nil
}
}
@ -84,15 +84,15 @@ func (p *remotePlacement) BuildPlacement(addr *object.Address, policy *netmapSDK
for i := range vs {
for j := 0; j < len(vs[i]); j++ {
var addr network.Address
var addr network.AddressGroup
err := addr.FromString(vs[i][j].Address())
err := addr.FromIterator(vs[i][j])
if err != nil {
// TODO: log error
continue
}
if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) {
if network.IsLocalAddress(p.localAddrSrc, addr) {
vs[i] = append(vs[i][:j], vs[i][j+1:]...)
j--
}