store

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: AGPL-3.0, ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrIllegalNewRound             = "illegal new round number in new state"
	ErrPersistentStoreBackendIsNil = "persistent store backend is nil"
)
View Source
const BoltRootChainStoreFileName = "rootchain.db"

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltStore

type BoltStore struct {
	// contains filtered or unexported fields
}

func NewBoltStore

func NewBoltStore(dbFile string) (*BoltStore, error)

func (*BoltStore) AddIR

func (*BoltStore) CountUC

func (s *BoltStore) CountUC() (int, error)

func (*BoltStore) GetAllIRs

func (*BoltStore) GetIR

func (*BoltStore) GetUC

func (*BoltStore) ReadAllUC

func (*BoltStore) ReadLatestRoundNumber

func (s *BoltStore) ReadLatestRoundNumber() (uint64, error)

func (*BoltStore) ReadLatestRoundRootHash

func (s *BoltStore) ReadLatestRoundRootHash() ([]byte, error)

func (*BoltStore) WriteState

func (s *BoltStore) WriteState(newState RootState) error

type InMemState

type InMemState struct {
	// contains filtered or unexported fields
}

func NewInMemStateStore

func NewInMemStateStore(hashAlgorithm gocrypto.Hash) *InMemState

NewInMemStateStore stores state in volatile memory only, everything is lost on exit

func (*InMemState) Get

func (s *InMemState) Get() (RootState, error)

func (*InMemState) Save

func (s *InMemState) Save(newState RootState) error

type PersistentRootState

type PersistentRootState struct {
	// contains filtered or unexported fields
}

func NewPersistentStateStore

func NewPersistentStateStore(store *BoltStore) (*PersistentRootState, error)

NewPersistentStateStore persists state using the persistent storage provider interface Currently uses RootSate as cache (probably should be refactored)

func (*PersistentRootState) Get

func (p *PersistentRootState) Get() (RootState, error)

func (*PersistentRootState) Save

func (p *PersistentRootState) Save(newState RootState) error

type RootState

type RootState struct {
	LatestRound    uint64
	LatestRootHash []byte
	Certificates   map[protocol.SystemIdentifier]*certificates.UnicityCertificate
}

func (*RootState) Update

func (r *RootState) Update(newState RootState)

Jump to

Keyboard shortcuts

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