forked from TrueCloudLab/frostfs-node
27 lines
804 B
Go
27 lines
804 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.
|
|
// If vub > 0, vub will be used as valid until block value.
|
|
func (c *Client) NewEpoch(epoch uint64, vub uint32, force bool) (uint32, error) {
|
|
prm := client.InvokePrm{}
|
|
prm.SetMethod(newEpochMethod)
|
|
prm.SetArgs(epoch)
|
|
prm.SetControlTX(force)
|
|
prm.SetVUB(vub)
|
|
|
|
res, err := c.client.Invoke(prm)
|
|
if err != nil {
|
|
return 0, fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
|
|
}
|
|
return res.VUB, nil
|
|
}
|