burrow: github.com/hyperledger/burrow/execution/state Index | Files

package state

import "github.com/hyperledger/burrow/execution/state"


Package Files

abi.go accounts.go dump.go events.go names.go proposals.go registry.go state.go validators.go version.go


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.


var Prefixes [][]byte

func HeightAtVersion Uses

func HeightAtVersion(version int64) uint64

func LoadValidatorRing Uses

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 Uses

func VersionAtHeight(height uint64) int64

type KeyFormatStore Uses

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 Uses

type ReadState struct {
    Forest storage.ForestReader
    Plain  *storage.PrefixDB

func (*ReadState) GetAccount Uses

func (s *ReadState) GetAccount(address crypto.Address) (*acm.Account, error)

Returns nil if account does not exist with given address.

func (*ReadState) GetMetadata Uses

func (s *ReadState) GetMetadata(metahash acmstate.MetadataHash) (string, error)

func (*ReadState) GetName Uses

func (s *ReadState) GetName(name string) (*names.Entry, error)

func (*ReadState) GetNodeByID Uses

func (s *ReadState) GetNodeByID(id crypto.Address) (*registry.NodeIdentity, error)

func (*ReadState) GetProposal Uses

func (s *ReadState) GetProposal(proposalHash []byte) (*payload.Ballot, error)

func (*ReadState) GetStorage Uses

func (s *ReadState) GetStorage(address crypto.Address, key binary.Word256) ([]byte, error)

func (*ReadState) IterateAccounts Uses

func (s *ReadState) IterateAccounts(consumer func(*acm.Account) error) error

func (*ReadState) IterateNames Uses

func (s *ReadState) IterateNames(consumer func(*names.Entry) error) error

func (*ReadState) IterateNodes Uses

func (s *ReadState) IterateNodes(consumer func(crypto.Address, *registry.NodeIdentity) error) error

func (*ReadState) IterateProposals Uses

func (s *ReadState) IterateProposals(consumer func(proposalHash []byte, proposal *payload.Ballot) error) error

func (*ReadState) IterateStorage Uses

func (s *ReadState) IterateStorage(address crypto.Address, consumer func(key binary.Word256, value []byte) error) error

func (*ReadState) IterateStreamEvents Uses

func (s *ReadState) 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 (*ReadState) IterateValidators Uses

func (s *ReadState) IterateValidators(fn func(id crypto.Addressable, power *big.Int) error) error

func (*ReadState) LastStoredHeight Uses

func (s *ReadState) LastStoredHeight() (uint64, error)

Get the last block height we stored in state

func (*ReadState) Power Uses

func (s *ReadState) Power(id crypto.Address) (*big.Int, error)

func (*ReadState) TxByHash Uses

func (s *ReadState) TxByHash(txHash []byte) (*exec.TxExecution, error)

func (*ReadState) TxsAtHeight Uses

func (s *ReadState) TxsAtHeight(height uint64) ([]*exec.TxExecution, error)

type State Uses

type State struct {

    // contains filtered or unexported fields

Writers to state are responsible for calling State.Lock() before calling

func LoadState Uses

func LoadState(db dbm.DB, version int64) (*State, error)

Tries to load the execution state from DB, returns nil with no error if no state found

func MakeGenesisState Uses

func MakeGenesisState(db dbm.DB, genesisDoc *genesis.GenesisDoc) (*State, error)

Make genesis state from GenesisDoc and save to DB

func NewState Uses

func NewState(db dbm.DB) *State

NewState creates a new State object

func (*State) Copy Uses

func (s *State) Copy(db dbm.DB) (*State, error)

Creates a copy of the database to the supplied db

func (*State) Dump Uses

func (s *State) Dump() string

func (*State) GetAccountStats Uses

func (s *State) GetAccountStats() acmstate.AccountStats

func (*State) GetNodeIDsByAddress Uses

func (s *State) GetNodeIDsByAddress(net string) ([]crypto.Address, error)

func (*State) GetNumPeers Uses

func (s *State) GetNumPeers() int

func (*State) Hash Uses

func (s *State) Hash() []byte

func (*State) InitialCommit Uses

func (s *State) InitialCommit() error

func (*State) LoadHeight Uses

func (s *State) LoadHeight(height uint64) (*ReadState, error)

func (*State) SetLogger Uses

func (s *State) SetLogger(logger *logging.Logger)

func (*State) Update Uses

func (s *State) Update(updater func(up Updatable) error) ([]byte, int64, error)

Perform updates to state whilst holding the write lock, allows a commit to hold the write lock across multiple operations while preventing interlaced reads and writes

func (*State) Version Uses

func (s *State) Version() int64

type Updatable Uses

type Updatable interface {
    AddBlock(blockExecution *exec.BlockExecution) error

Package state imports 22 packages (graph) and is imported by 32 packages. Updated 2020-05-03. Refresh now. Tools for package owners.