2021-01-28 11:39:08 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
2021-05-18 08:12:51 +00:00
|
|
|
"fmt"
|
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-05-18 08:12:51 +00:00
|
|
|
if err := c.client.Invoke(c.startEstimation, args.epoch); err != nil {
|
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.startEstimation, err)
|
|
|
|
}
|
|
|
|
return nil
|
2021-04-29 13:35:26 +00:00
|
|
|
}
|
|
|
|
|
2021-05-25 12:16:59 +00:00
|
|
|
// Deprecated: construct underlying StaticClient with TryNotary() option
|
|
|
|
// and use StartEstimation.
|
2021-04-29 13:35:26 +00:00
|
|
|
func (c *Client) StartEstimationNotary(args StartEstimation) error {
|
2021-05-18 08:12:51 +00:00
|
|
|
if err := c.client.NotaryInvoke(c.startEstimation, args.epoch); err != nil {
|
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.startEstimation, err)
|
|
|
|
}
|
|
|
|
return nil
|
2021-01-28 11:39:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) StopEstimation(args StopEstimation) error {
|
2021-05-18 08:12:51 +00:00
|
|
|
if err := c.client.Invoke(c.stopEstimation, args.epoch); err != nil {
|
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.stopEstimation, err)
|
|
|
|
}
|
|
|
|
return nil
|
2021-04-29 13:35:26 +00:00
|
|
|
}
|
|
|
|
|
2021-05-25 12:16:59 +00:00
|
|
|
// Deprecated: construct underlying StaticClient with TryNotary() option
|
|
|
|
// and use StopEstimation.
|
2021-04-29 13:35:26 +00:00
|
|
|
func (c *Client) StopEstimationNotary(args StopEstimation) error {
|
2021-05-18 08:12:51 +00:00
|
|
|
if err := c.client.NotaryInvoke(c.stopEstimation, args.epoch); err != nil {
|
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.stopEstimation, err)
|
|
|
|
}
|
|
|
|
return nil
|
2021-01-28 11:39:08 +00:00
|
|
|
}
|