2020-07-24 13:54:03 +00:00
|
|
|
package netmap
|
|
|
|
|
2021-05-18 08:12:51 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
2021-11-09 20:52:29 +00:00
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
2021-05-18 08:12:51 +00:00
|
|
|
)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
|
|
|
// NewEpochArgs groups the arguments
|
|
|
|
// of new epoch invocation call.
|
|
|
|
type NewEpochArgs struct {
|
|
|
|
number int64 // new epoch number
|
2021-11-10 10:44:19 +00:00
|
|
|
|
|
|
|
client.InvokePrmOptional
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetEpochNumber sets the new epoch number.
|
|
|
|
func (a *NewEpochArgs) SetEpochNumber(v int64) {
|
|
|
|
a.number = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewEpoch invokes the call of new epoch method
|
|
|
|
// of NeoFS Netmap contract.
|
|
|
|
func (c *Client) NewEpoch(args NewEpochArgs) error {
|
2021-11-09 20:52:29 +00:00
|
|
|
prm := client.InvokePrm{}
|
|
|
|
|
|
|
|
prm.SetMethod(c.newEpochMethod)
|
|
|
|
prm.SetArgs(args.number)
|
2021-11-10 10:44:19 +00:00
|
|
|
prm.InvokePrmOptional = args.InvokePrmOptional
|
2021-11-09 20:52:29 +00:00
|
|
|
|
|
|
|
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.newEpochMethod, err)
|
|
|
|
}
|
|
|
|
return nil
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|