Documentation ¶
Index ¶
- Constants
- Variables
- func HeightAtVersion(version int64) uint64
- func LoadValidatorRing(version int64, ringSize int, ...) (*validator.Ring, error)
- func VersionAtHeight(height uint64) int64
- type ImmutableState
- func (s *ImmutableState) GetAccount(address crypto.Address) (*acm.Account, error)
- func (s *ImmutableState) GetName(name string) (*names.Entry, error)
- func (s *ImmutableState) GetNodeByID(id crypto.Address) (*registry.NodeIdentity, error)
- func (s *ImmutableState) GetProposal(proposalHash []byte) (*payload.Ballot, error)
- func (s *ImmutableState) GetStorage(address crypto.Address, key binary.Word256) ([]byte, error)
- func (s *ImmutableState) IterateAccounts(consumer func(*acm.Account) error) error
- func (s *ImmutableState) IterateNames(consumer func(*names.Entry) error) error
- func (s *ImmutableState) IterateNodes(consumer func(crypto.Address, *registry.NodeIdentity) error) error
- func (s *ImmutableState) IterateProposals(consumer func(proposalHash []byte, proposal *payload.Ballot) error) error
- func (s *ImmutableState) IterateStorage(address crypto.Address, consumer func(key binary.Word256, value []byte) error) error
- func (s *ImmutableState) IterateStreamEvents(startHeight, endHeight *uint64, sortOrder storage.SortOrder, ...) error
- func (s *ImmutableState) IterateValidators(fn func(id crypto.Addressable, power *big.Int) error) error
- func (s *ImmutableState) LastStoredHeight() (uint64, error)
- func (s *ImmutableState) Power(id crypto.Address) (*big.Int, error)
- func (s *ImmutableState) TxsAtHeight(height uint64) ([]*exec.TxExecution, error)
- type KeyFormatStore
- type ReadState
- type State
- func (s *State) AtHeight(height uint64) (*ImmutableState, error)
- func (s *State) AtLatestVersion() (*ImmutableState, error)
- func (s *State) AtVersion(version int64) (*ImmutableState, error)
- func (s *State) Copy(db dbm.DB) (*State, error)
- func (s *State) Dump() string
- func (s *State) GetAccountStats() acmstate.AccountStats
- func (s *State) GetNodeIDsByAddress(net string) ([]crypto.Address, error)
- func (s *State) GetNumPeers() int
- func (s *State) Hash() []byte
- func (s *State) InitialCommit() error
- func (s *State) SetLogger(logger *logging.Logger)
- func (s *State) Update(updater func(up Updatable) error) ([]byte, int64, error)
- func (s *State) Version() int64
- type Updatable
Constants ¶
const (
DefaultValidatorsWindowSize = 10
)
const VersionOffset = int64(1)
Since we have an initial save of our state forest we start one version ahead of the block height, but from then on we should track height by this offset.
Variables ¶
var Prefixes [][]byte
Functions ¶
func HeightAtVersion ¶
func LoadValidatorRing ¶
func LoadValidatorRing(version int64, ringSize int, getImmutable func(version int64) (*storage.ImmutableForest, error)) (*validator.Ring, error)
Initialises the validator Ring from the validator storage in forest
func VersionAtHeight ¶
Types ¶
type ImmutableState ¶ added in v0.34.4
type ImmutableState struct { Forest storage.ForestReader validator.History }
This is the immutable merklised read state at a given finalised height
func (*ImmutableState) GetAccount ¶ added in v0.34.4
Returns nil if account does not exist with given address.
func (*ImmutableState) GetName ¶ added in v0.34.4
func (s *ImmutableState) GetName(name string) (*names.Entry, error)
func (*ImmutableState) GetNodeByID ¶ added in v0.34.4
func (s *ImmutableState) GetNodeByID(id crypto.Address) (*registry.NodeIdentity, error)
func (*ImmutableState) GetProposal ¶ added in v0.34.4
func (s *ImmutableState) GetProposal(proposalHash []byte) (*payload.Ballot, error)
func (*ImmutableState) GetStorage ¶ added in v0.34.4
func (*ImmutableState) IterateAccounts ¶ added in v0.34.4
func (s *ImmutableState) IterateAccounts(consumer func(*acm.Account) error) error
func (*ImmutableState) IterateNames ¶ added in v0.34.4
func (s *ImmutableState) IterateNames(consumer func(*names.Entry) error) error
func (*ImmutableState) IterateNodes ¶ added in v0.34.4
func (s *ImmutableState) IterateNodes(consumer func(crypto.Address, *registry.NodeIdentity) error) error
func (*ImmutableState) IterateProposals ¶ added in v0.34.4
func (*ImmutableState) IterateStorage ¶ added in v0.34.4
func (*ImmutableState) IterateStreamEvents ¶ added in v0.34.4
func (s *ImmutableState) IterateStreamEvents(startHeight, endHeight *uint64, sortOrder storage.SortOrder, consumer func(*exec.StreamEvent) error) error
Iterate SteamEvents over the closed interval [startHeight, endHeight] - i.e. startHeight and endHeight inclusive
func (*ImmutableState) IterateValidators ¶ added in v0.34.4
func (s *ImmutableState) IterateValidators(fn func(id crypto.Addressable, power *big.Int) error) error
func (*ImmutableState) LastStoredHeight ¶ added in v0.34.4
func (s *ImmutableState) LastStoredHeight() (uint64, error)
Get the last block height we stored in state
func (*ImmutableState) TxsAtHeight ¶ added in v0.34.4
func (s *ImmutableState) TxsAtHeight(height uint64) ([]*exec.TxExecution, error)
type KeyFormatStore ¶
type KeyFormatStore struct { Account *storage.MustKeyFormat Storage *storage.MustKeyFormat Name *storage.MustKeyFormat Proposal *storage.MustKeyFormat Validator *storage.MustKeyFormat Event *storage.MustKeyFormat Registry *storage.MustKeyFormat TxHash *storage.MustKeyFormat Abi *storage.MustKeyFormat }
type ReadState ¶
type ReadState struct { ImmutableState Plain *storage.PrefixDB }
func (*ReadState) GetMetadata ¶ added in v0.34.4
func (s *ReadState) GetMetadata(metahash acmstate.MetadataHash) (string, error)
type State ¶
Writers to state are responsible for calling State.Lock() before calling
func LoadState ¶
Tries to load the execution state from DB, returns nil with no error if no state found
func MakeGenesisState ¶
Make genesis state from GenesisDoc and save to DB
func (*State) AtHeight ¶ added in v0.34.4
func (s *State) AtHeight(height uint64) (*ImmutableState, error)
Return a concurrent-safe immutable read state at the given height
func (*State) AtLatestVersion ¶ added in v0.34.4
func (s *State) AtLatestVersion() (*ImmutableState, error)
func (*State) AtVersion ¶ added in v0.34.4
func (s *State) AtVersion(version int64) (*ImmutableState, error)
Return a concurrent-safe immutable read state at the given version
func (*State) GetAccountStats ¶
func (s *State) GetAccountStats() acmstate.AccountStats