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

@ -23,7 +23,7 @@ func (w Wrapper) GetNetMap(diff uint64) (*netmap.Netmap, error) {
}
rawPeers := peers.Peers() // slice of serialized node infos
infos := make([]v2netmap.NodeInfo, 0, len(rawPeers))
infos := make([]netmap.NodeInfo, 0, len(rawPeers))
for _, peer := range rawPeers {
grpcNodeInfo := new(grpcNetmap.NodeInfo) // transport representation of struct
@ -35,10 +35,10 @@ func (w Wrapper) GetNetMap(diff uint64) (*netmap.Netmap, error) {
}
v2 := v2netmap.NodeInfoFromGRPCMessage(grpcNodeInfo)
infos = append(infos, *v2)
infos = append(infos, *netmap.NewNodeInfoFromV2(v2))
}
nodes := netmap.NodesFromV2(infos)
nodes := netmap.NodesFromInfo(infos)
return netmap.NewNetmap(nodes)
}