[#155] Update neofs-api-go with refactored pkg/netmap

Refactored pkg/netmap package provides JSON converters for
NodeInfo and PlacementPolicy structures, that has been used
by client applications.

It also updates Node structure itself so it is a part of
grpc <-> v2 <-> pkg conversion chain.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-11-05 18:51:43 +03:00 committed by Alex Vanin
parent 9f8eb0fd51
commit 65be09d3db
16 changed files with 100 additions and 125 deletions

View file

@ -174,14 +174,14 @@ func lookupKeyInContainer(
owner, cid []byte,
cnr *container.Container) (bool, error) {
cnrNodes, err := nm.GetContainerNodes(cnr.GetPlacementPolicy(), cid)
cnrNodes, err := nm.GetContainerNodes(netmap.NewPlacementPolicyFromV2(cnr.GetPlacementPolicy()), cid)
if err != nil {
return false, err
}
flatCnrNodes := cnrNodes.Flatten() // we need single array to iterate on
for i := range flatCnrNodes {
if bytes.Equal(flatCnrNodes[i].InfoV2.GetPublicKey(), owner) {
if bytes.Equal(flatCnrNodes[i].PublicKey(), owner) {
return true, nil
}
}