[#645] placement: Overload result of Traverser.Next method

In previous implementation `placement.Traverser.Next` method returned slice
of `network.AddressGroup` elements. There is a need to process keys of
storage nodes besides network addresses for intra-container communication.

Wrap `network.AddressGroup` in a new type `placement.Node` that summarizes
the storage node information required for communication. Return slice of
`Node` instances from `Traverser.Next` method. Fix compilation breaks in
dependent packages.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-06 14:35:06 +03:00 committed by Alex Vanin
parent 3c848b2cad
commit fe90456dcc
6 changed files with 29 additions and 17 deletions

View file

@ -95,7 +95,7 @@ func TestTraverserObjectScenarios(t *testing.T) {
require.Len(t, addrs, len(nodes[i]))
for j, n := range nodes[i] {
assertSameAddress(t, n.NodeInfo, addrs[j])
assertSameAddress(t, n.NodeInfo, addrs[j].Addresses())
}
}
@ -129,7 +129,7 @@ func TestTraverserObjectScenarios(t *testing.T) {
err = n.FromIterator(nodes[1][0])
require.NoError(t, err)
require.Equal(t, []network.AddressGroup{n}, tr.Next())
require.Equal(t, []Node{{addresses: n}}, tr.Next())
})
t.Run("put scenario", func(t *testing.T) {
@ -152,7 +152,7 @@ func TestTraverserObjectScenarios(t *testing.T) {
require.Len(t, addrs, replicas[curVector])
for j := range addrs {
assertSameAddress(t, nodes[curVector][i+j].NodeInfo, addrs[j])
assertSameAddress(t, nodes[curVector][i+j].NodeInfo, addrs[j].Addresses())
}
}