forked from TrueCloudLab/frostfs-node
[#787] netmap: Refactor NewEpoch
method
Split for user and control methods. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
c8a62ffedd
commit
8088063195
3 changed files with 20 additions and 9 deletions
|
@ -8,15 +8,27 @@ import (
|
|||
|
||||
// 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) {
|
||||
func (c *Client) NewEpoch(epoch uint64) error {
|
||||
prm := client.InvokePrm{}
|
||||
prm.SetMethod(newEpochMethod)
|
||||
prm.SetArgs(epoch)
|
||||
prm.SetControlTX(force)
|
||||
|
||||
_, err := c.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewEpochControl updates FrostFS epoch number through
|
||||
// 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) NewEpochControl(epoch uint64, vub uint32) (uint32, error) {
|
||||
prm := client.InvokePrm{}
|
||||
prm.SetMethod(newEpochMethod)
|
||||
prm.SetArgs(epoch)
|
||||
prm.SetControlTX(true)
|
||||
prm.SetVUB(vub)
|
||||
|
||||
res, err := c.client.Invoke(prm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue