[#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

@ -132,7 +132,7 @@ func NetmapSnapshot(cli *client.Client, con util.Uint160) (*netmap.Netmap, error
return nil, err
}
result := make([]netmapv2.NodeInfo, 0, len(rawNodeInfos))
result := make([]netmap.NodeInfo, 0, len(rawNodeInfos))
for i := range rawNodeInfos {
nodeInfo, err := peerInfoFromStackItem(rawNodeInfos[i])
@ -140,10 +140,10 @@ func NetmapSnapshot(cli *client.Client, con util.Uint160) (*netmap.Netmap, error
return nil, errors.Wrap(err, "invalid RPC response")
}
result = append(result, *nodeInfo)
result = append(result, *netmap.NewNodeInfoFromV2(nodeInfo))
}
return netmap.NewNetmap(netmap.NodesFromV2(result))
return netmap.NewNetmap(netmap.NodesFromInfo(result))
}
func peerInfoFromStackItem(prm stackitem.Item) (*netmapv2.NodeInfo, error) {