state

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(state *State) *Cache

func (*Cache) AddToPool

func (c *Cache) AddToPool(val *validator.Validator) error

func (*Cache) AddToSet

func (c *Cache) AddToSet(val *validator.Validator) error

func (*Cache) Flush

func (c *Cache) Flush(set *validator.ValidatorSet) error

func (*Cache) GetAccount

func (c *Cache) GetAccount(addr crypto.Address) (*account.Account, error)

func (*Cache) GetStorage

func (c *Cache) GetStorage(addr crypto.Address, key binary.Word256) (binary.Word256, error)

func (*Cache) GetValidator

func (c *Cache) GetValidator(addr crypto.Address) (*validator.Validator, error)

func (*Cache) HasAccount

func (c *Cache) HasAccount(addr crypto.Address) bool

func (*Cache) HasPermissions

func (c *Cache) HasPermissions(acc *account.Account, perm account.Permissions) bool

func (*Cache) HasValidator

func (c *Cache) HasValidator(addr crypto.Address) bool

func (*Cache) RemoveAccount added in v0.5.0

func (c *Cache) RemoveAccount(addr crypto.Address) error

func (*Cache) RemoveFromPool

func (c *Cache) RemoveFromPool(val *validator.Validator) error

func (*Cache) Reset

func (c *Cache) Reset()

func (*Cache) SetStorage

func (c *Cache) SetStorage(addr crypto.Address, key, value binary.Word256) error

func (*Cache) UpdateAccount

func (c *Cache) UpdateAccount(acc *account.Account) error

func (*Cache) UpdateValidator

func (c *Cache) UpdateValidator(val *validator.Validator) error

type CacheOption

type CacheOption func(*Cache)

type State

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

func LoadState

func LoadState(db dbm.DB, hash []byte) (*State, error)

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

func NewState

func NewState(db dbm.DB) *State

NewState creates a new instance of State object

func (*State) AccountCount

func (st *State) AccountCount() int

func (*State) ByzantineValidator

func (st *State) ByzantineValidator(addr crypto.Address) error

func (*State) GetAccount

func (st *State) GetAccount(addr crypto.Address) (*account.Account, error)

func (*State) GetStorage

func (st *State) GetStorage(addr crypto.Address, key binary.Word256) (binary.Word256, error)

func (*State) GetValidator

func (st *State) GetValidator(addr crypto.Address) (*validator.Validator, error)

func (*State) GlobalAccount

func (st *State) GlobalAccount() *account.Account

func (*State) HasAccount

func (st *State) HasAccount(addr crypto.Address) bool

func (*State) HasBondPermission

func (st *State) HasBondPermission(acc *account.Account) bool

func (*State) HasCallPermission

func (st *State) HasCallPermission(acc *account.Account) bool

func (*State) HasCreateAccountPermission

func (st *State) HasCreateAccountPermission(acc *account.Account) bool

func (*State) HasCreateContractPermission

func (st *State) HasCreateContractPermission(acc *account.Account) bool

func (*State) HasModifyPermission

func (st *State) HasModifyPermission(acc *account.Account) bool

func (*State) HasPermissions

func (st *State) HasPermissions(acc *account.Account, perm account.Permissions) bool

HasPermissions ensures that an account has required permissions

func (*State) HasSendPermission

func (st *State) HasSendPermission(acc *account.Account) bool

func (*State) HasValidator

func (st *State) HasValidator(addr crypto.Address) bool

func (*State) IncentivizeValidator

func (st *State) IncentivizeValidator(addr crypto.Address, fee uint64) error

func (*State) IterateAccounts

func (st *State) IterateAccounts(consumer func(*account.Account) (stop bool)) (stopped bool, err error)

func (*State) IterateStorage

func (st *State) IterateStorage(addr crypto.Address,
	consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error)

func (*State) IterateValidators

func (st *State) IterateValidators(consumer func(*validator.Validator) (stop bool)) (stopped bool, err error)

func (*State) SaveState

func (st *State) SaveState() ([]byte, error)

func (*State) UpdateGenesisState

func (st *State) UpdateGenesisState(gen *proposal.Genesis) error

UpdateGenesisState updates state at genesis time

func (*State) ValidatorCount

func (st *State) ValidatorCount() int

Jump to

Keyboard shortcuts

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