frostfs-node/pkg/morph/client/netmap/new_epoch.go
Alejandro Lopez ff25521204
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
[#270] Add IR epoch tick control call
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
2023-04-28 07:57:00 +00:00

24 lines
688 B
Go

package netmap
import (
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
)
// NewEpoch updates FrostFS epoch number through
// Netmap contract call.
// If `force` is true, this call is normally initiated by a control
// service command and uses a control notary transaction internally
// to ensure all nodes produce the same transaction with high probability.
func (c *Client) NewEpoch(epoch uint64, force bool) error {
prm := client.InvokePrm{}
prm.SetMethod(newEpochMethod)
prm.SetArgs(epoch)
prm.SetControlTX(force)
if err := c.client.Invoke(prm); err != nil {
return fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
}
return nil
}