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