2021-01-28 11:39:08 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
2021-05-18 08:12:51 +00:00
|
|
|
"fmt"
|
2021-11-09 20:52:29 +00:00
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
2021-01-28 11:39:08 +00:00
|
|
|
)
|
|
|
|
|
2021-11-12 15:14:55 +00:00
|
|
|
// StartEstimation groups parameters of StartEstimation operation.
|
2021-01-28 11:39:08 +00:00
|
|
|
type StartEstimation struct {
|
|
|
|
epoch int64
|
2021-11-12 15:14:55 +00:00
|
|
|
|
|
|
|
client.InvokePrmOptional
|
2021-01-28 11:39:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *StartEstimation) SetEpoch(v int64) {
|
|
|
|
e.epoch = v
|
|
|
|
}
|
|
|
|
|
|
|
|
type StopEstimation struct {
|
|
|
|
epoch int64
|
2021-11-12 15:14:55 +00:00
|
|
|
|
|
|
|
client.InvokePrmOptional
|
2021-01-28 11:39:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *StopEstimation) SetEpoch(v int64) {
|
|
|
|
e.epoch = v
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) StartEstimation(args StartEstimation) error {
|
2021-11-09 20:52:29 +00:00
|
|
|
prm := client.InvokePrm{}
|
|
|
|
|
2022-01-29 13:06:36 +00:00
|
|
|
prm.SetMethod(startEstimationMethod)
|
2021-11-09 20:52:29 +00:00
|
|
|
prm.SetArgs(args.epoch)
|
2021-11-12 15:14:55 +00:00
|
|
|
prm.InvokePrmOptional = args.InvokePrmOptional
|
2021-11-09 20:52:29 +00:00
|
|
|
|
|
|
|
if err := c.client.Invoke(prm); err != nil {
|
2022-01-29 13:06:36 +00:00
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", startEstimationMethod, err)
|
2021-05-18 08:12:51 +00:00
|
|
|
}
|
|
|
|
return nil
|
2021-04-29 13:35:26 +00:00
|
|
|
}
|
|
|
|
|
2021-01-28 11:39:08 +00:00
|
|
|
func (c *Client) StopEstimation(args StopEstimation) error {
|
2021-11-09 20:52:29 +00:00
|
|
|
prm := client.InvokePrm{}
|
|
|
|
|
2022-01-29 13:06:36 +00:00
|
|
|
prm.SetMethod(stopEstimationMethod)
|
2021-11-09 20:52:29 +00:00
|
|
|
prm.SetArgs(args.epoch)
|
2021-11-12 15:14:55 +00:00
|
|
|
prm.InvokePrmOptional = args.InvokePrmOptional
|
2021-11-09 20:52:29 +00:00
|
|
|
|
|
|
|
if err := c.client.Invoke(prm); err != nil {
|
2022-01-29 13:06:36 +00:00
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", stopEstimationMethod, err)
|
2021-05-18 08:12:51 +00:00
|
|
|
}
|
|
|
|
return nil
|
2021-04-29 13:35:26 +00:00
|
|
|
}
|