2022-01-31 11:58:55 +00:00
|
|
|
package netmap
|
|
|
|
|
|
|
|
import (
|
2024-12-04 08:17:13 +00:00
|
|
|
"fmt"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
2022-01-31 11:58:55 +00:00
|
|
|
)
|
|
|
|
|
2022-09-28 11:34:28 +00:00
|
|
|
// GetNetMap calls "snapshot" method and decodes netmap.NetMap from the response.
|
2022-06-08 23:18:26 +00:00
|
|
|
func (c *Client) GetNetMap(diff uint64) (*netmap.NetMap, error) {
|
2022-01-31 11:58:55 +00:00
|
|
|
prm := client.TestInvokePrm{}
|
|
|
|
prm.SetMethod(snapshotMethod)
|
2022-03-11 09:28:34 +00:00
|
|
|
prm.SetArgs(diff)
|
2022-01-31 11:58:55 +00:00
|
|
|
|
|
|
|
res, err := c.client.TestInvoke(prm)
|
|
|
|
if err != nil {
|
2024-12-04 08:17:13 +00:00
|
|
|
return nil, fmt.Errorf("test invoke (%s): %w", snapshotMethod, err)
|
2022-01-31 11:58:55 +00:00
|
|
|
}
|
|
|
|
|
2023-01-31 10:33:33 +00:00
|
|
|
return DecodeNetMap(res)
|
2022-01-31 11:58:55 +00:00
|
|
|
}
|