state

package
v0.0.0-...-ee95d54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OffsetKey = "offset"
)

Variables

This section is empty.

Functions

func MakeCompositeKey

func MakeCompositeKey(prefix, key string) []byte

func MakeCompositeKeyString

func MakeCompositeKeyString(prefix, key string) string

Types

type LevelDBState

type LevelDBState struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLevelDBState

func NewLevelDBState(stateDbPath string, topic string) (*LevelDBState, error)

func (*LevelDBState) Delete

func (s *LevelDBState) Delete(key string) error

func (*LevelDBState) Get

func (s *LevelDBState) Get(key string) ([]byte, error)

func (*LevelDBState) GetOrError

func (s *LevelDBState) GetOrError(key string) ([]byte, error)

func (*LevelDBState) LoadOffset

func (s *LevelDBState) LoadOffset() (uint64, error)

func (*LevelDBState) NewStateFromOld

func (s *LevelDBState) NewStateFromOld(stateDbPath string) (State, string, error)

func (*LevelDBState) Reset

func (s *LevelDBState) Reset(stateDbPath string) (string, error)

Reset creates new underlying leveldb storage

func (*LevelDBState) SaveOffset

func (s *LevelDBState) SaveOffset(offset uint64) error

func (*LevelDBState) Set

func (s *LevelDBState) Set(key string, value []byte) error

type State

type State interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Delete(key string) error
	Reset(stateDbPath string) (string, error)

	SaveOffset(uint64) error
	LoadOffset() (uint64, error)
	GetOrError(key string) ([]byte, error)
}

State is the node's state (it keeps the offset, the signatures and the Operation pool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL