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
|
|
|
)
|
|
|
|
|
|
|
|
type StartEstimation struct {
|
|
|
|
epoch int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *StartEstimation) SetEpoch(v int64) {
|
|
|
|
e.epoch = v
|
|
|
|
}
|
|
|
|
|
|
|
|
type StopEstimation struct {
|
|
|
|
epoch int64
|
|
|
|
}
|
|
|
|
|
|
|
|
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{}
|
|
|
|
|
|
|
|
prm.SetMethod(c.startEstimation)
|
|
|
|
prm.SetArgs(args.epoch)
|
|
|
|
|
|
|
|
if err := c.client.Invoke(prm); err != nil {
|
2021-05-18 08:12:51 +00:00
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.startEstimation, err)
|
|
|
|
}
|
|
|
|
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{}
|
|
|
|
|
|
|
|
prm.SetMethod(c.stopEstimation)
|
|
|
|
prm.SetArgs(args.epoch)
|
|
|
|
|
|
|
|
if err := c.client.Invoke(prm); err != nil {
|
2021-05-18 08:12:51 +00:00
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.stopEstimation, err)
|
|
|
|
}
|
|
|
|
return nil
|
2021-04-29 13:35:26 +00:00
|
|
|
}
|