frostfs-node/pkg/morph/client/container/estimations.go
Evgenii Stratonikov 3c5b62d839 [#625] morph/client: make method names constant
We don't use custom names and the only place where custom method option
is used it provides the default name and can be omitted.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-01 15:47:54 +03:00

54 lines
1.1 KiB
Go

package container
import (
"fmt"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
)
// StartEstimation groups parameters of StartEstimation operation.
type StartEstimation struct {
epoch int64
client.InvokePrmOptional
}
func (e *StartEstimation) SetEpoch(v int64) {
e.epoch = v
}
type StopEstimation struct {
epoch int64
client.InvokePrmOptional
}
func (e *StopEstimation) SetEpoch(v int64) {
e.epoch = v
}
func (c *Client) StartEstimation(args StartEstimation) error {
prm := client.InvokePrm{}
prm.SetMethod(startEstimationMethod)
prm.SetArgs(args.epoch)
prm.InvokePrmOptional = args.InvokePrmOptional
if err := c.client.Invoke(prm); err != nil {
return fmt.Errorf("could not invoke method (%s): %w", startEstimationMethod, err)
}
return nil
}
func (c *Client) StopEstimation(args StopEstimation) error {
prm := client.InvokePrm{}
prm.SetMethod(stopEstimationMethod)
prm.SetArgs(args.epoch)
prm.InvokePrmOptional = args.InvokePrmOptional
if err := c.client.Invoke(prm); err != nil {
return fmt.Errorf("could not invoke method (%s): %w", stopEstimationMethod, err)
}
return nil
}