forked from TrueCloudLab/frostfs-node
[#798] pkg/innerring: Save latest processed block number
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
2bcf22ad79
commit
005f54e61e
3 changed files with 67 additions and 3 deletions
|
@ -1,17 +1,25 @@
|
|||
package innerring
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/audit"
|
||||
control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/state"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const voteMethod = "vote"
|
||||
|
||||
var (
|
||||
persistateMainChainLastBlockKey = []byte("main_chain_last_processed_block")
|
||||
persistateSideChainLastBlockKey = []byte("side_chain_last_processed_block")
|
||||
)
|
||||
|
||||
// EpochCounter is a getter for a global epoch counter.
|
||||
func (s *Server) EpochCounter() uint64 {
|
||||
return s.epochCounter.Load()
|
||||
|
@ -140,3 +148,13 @@ func (s *Server) setHealthStatus(hs control.HealthStatus) {
|
|||
func (s *Server) HealthStatus() control.HealthStatus {
|
||||
return s.healthStatus.Load().(control.HealthStatus)
|
||||
}
|
||||
|
||||
func initPersistentStateStorage(cfg *viper.Viper) (*state.PersistentStorage, error) {
|
||||
persistPath := cfg.GetString("node.persistent_state.path")
|
||||
persistStorage, err := state.NewPersistentStorage(persistPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("persistent state init error: %w", err)
|
||||
}
|
||||
|
||||
return persistStorage, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue