Dmitrii Stepanov
8088063195
All checks were successful
DCO action / DCO (pull_request) Successful in 3m58s
Vulncheck / Vulncheck (pull_request) Successful in 4m51s
Build / Build Components (1.21) (pull_request) Successful in 5m47s
Build / Build Components (1.20) (pull_request) Successful in 5m57s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m25s
Tests and linters / Staticcheck (pull_request) Successful in 6m31s
Tests and linters / Lint (pull_request) Successful in 7m15s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m16s
Tests and linters / Tests with -race (pull_request) Successful in 8m30s
Split for user and control methods. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
39 lines
1 KiB
Go
39 lines
1 KiB
Go
package netmap
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
|
)
|
|
|
|
// NewEpoch updates FrostFS epoch number through
|
|
// Netmap contract call.
|
|
func (c *Client) NewEpoch(epoch uint64) error {
|
|
prm := client.InvokePrm{}
|
|
prm.SetMethod(newEpochMethod)
|
|
prm.SetArgs(epoch)
|
|
|
|
_, 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)
|
|
if err != nil {
|
|
return 0, fmt.Errorf("could not invoke method (%s): %w", newEpochMethod, err)
|
|
}
|
|
return res.VUB, nil
|
|
}
|