forked from TrueCloudLab/frostfs-node
[#1513] Upgrade NeoFS SDK Go with changed netmap
package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
24b4c1ecf4
commit
21d2f8f861
70 changed files with 878 additions and 992 deletions
|
@ -12,17 +12,17 @@ import (
|
|||
// through the Netmap contract call, composes network map
|
||||
// from them and returns it. With diff == 0 returns current
|
||||
// network map, else return snapshot of previous network map.
|
||||
func (c *Client) GetNetMap(diff uint64) (*netmap.Netmap, error) {
|
||||
func (c *Client) GetNetMap(diff uint64) (*netmap.NetMap, error) {
|
||||
return c.getNetMap(diff)
|
||||
}
|
||||
|
||||
// Snapshot returns current netmap node infos.
|
||||
// Consider using pkg/morph/client/netmap for this.
|
||||
func (c *Client) Snapshot() (*netmap.Netmap, error) {
|
||||
func (c *Client) Snapshot() (*netmap.NetMap, error) {
|
||||
return c.getNetMap(0)
|
||||
}
|
||||
|
||||
func (c *Client) getNetMap(diff uint64) (*netmap.Netmap, error) {
|
||||
func (c *Client) getNetMap(diff uint64) (*netmap.NetMap, error) {
|
||||
prm := client.TestInvokePrm{}
|
||||
prm.SetMethod(snapshotMethod)
|
||||
prm.SetArgs(diff)
|
||||
|
@ -35,7 +35,7 @@ func (c *Client) getNetMap(diff uint64) (*netmap.Netmap, error) {
|
|||
return unmarshalNetmap(res, snapshotMethod)
|
||||
}
|
||||
|
||||
func unmarshalNetmap(items []stackitem.Item, method string) (*netmap.Netmap, error) {
|
||||
func unmarshalNetmap(items []stackitem.Item, method string) (*netmap.NetMap, error) {
|
||||
rawPeers, err := peersFromStackItems(items, method)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -48,5 +48,8 @@ func unmarshalNetmap(items []stackitem.Item, method string) (*netmap.Netmap, err
|
|||
}
|
||||
}
|
||||
|
||||
return netmap.NewNetmap(netmap.NodesFromInfo(result))
|
||||
var nm netmap.NetMap
|
||||
nm.SetNodes(result)
|
||||
|
||||
return &nm, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue