frostfs-node/pkg/morph/client/netmap/snapshot.go
Evgenii Stratonikov e3487d5af5 [#1535] morph: Unify test invoke error messages
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-12-04 09:50:20 +00:00

22 lines
541 B
Go

package netmap
import (
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
)
// GetNetMap calls "snapshot" method and decodes netmap.NetMap from the response.
func (c *Client) GetNetMap(diff uint64) (*netmap.NetMap, error) {
prm := client.TestInvokePrm{}
prm.SetMethod(snapshotMethod)
prm.SetArgs(diff)
res, err := c.client.TestInvoke(prm)
if err != nil {
return nil, fmt.Errorf("test invoke (%s): %w", snapshotMethod, err)
}
return DecodeNetMap(res)
}