Documentation ¶
Index ¶
- func GetMutableAccount(getter AccountGetter, address crypto.Address) (acm.MutableAccount, error)
- func GlobalAccountPermissions(getter AccountGetter) ptypes.AccountPermissions
- func GlobalPermissionsAccount(getter AccountGetter) acm.Account
- type AccountGetter
- type AccountIterable
- type AccountUpdater
- type Cache
- func (cache *Cache) Flush(output Writer, backend Reader) error
- func (cache *Cache) GetAccount(address crypto.Address) (acm.Account, error)
- func (cache *Cache) GetStorage(address crypto.Address, key binary.Word256) (binary.Word256, error)
- func (cache *Cache) IterateCachedAccount(consumer func(acm.Account) (stop bool)) (stopped bool, err error)
- func (cache *Cache) IterateCachedStorage(address crypto.Address, consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error)
- func (cache *Cache) RemoveAccount(address crypto.Address) error
- func (cache *Cache) Reset(backend Reader)
- func (cache *Cache) SetStorage(address crypto.Address, key binary.Word256, value binary.Word256) error
- func (cache *Cache) String() string
- func (cache *Cache) Sync(state Writer) error
- func (cache *Cache) UpdateAccount(account acm.Account) error
- type CacheOption
- type Iterable
- type IterableReader
- type IterableReaderWriter
- type MemoryState
- func (ms *MemoryState) GetAccount(address crypto.Address) (acm.Account, error)
- func (ms *MemoryState) GetStorage(address crypto.Address, key binary.Word256) (binary.Word256, error)
- func (ms *MemoryState) IterateAccounts(consumer func(acm.Account) (stop bool)) (stopped bool, err error)
- func (ms *MemoryState) IterateStorage(address crypto.Address, consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error)
- func (ms *MemoryState) RemoveAccount(address crypto.Address) error
- func (ms *MemoryState) SetStorage(address crypto.Address, key, value binary.Word256) error
- func (ms *MemoryState) UpdateAccount(updatedAccount acm.Account) error
- type Reader
- type ReaderWriter
- type StorageGetter
- type StorageIterable
- type StorageSetter
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMutableAccount ¶
func GetMutableAccount(getter AccountGetter, address crypto.Address) (acm.MutableAccount, error)
func GlobalAccountPermissions ¶
func GlobalAccountPermissions(getter AccountGetter) ptypes.AccountPermissions
Get global permissions from the account at GlobalPermissionsAddress
func GlobalPermissionsAccount ¶
func GlobalPermissionsAccount(getter AccountGetter) acm.Account
Types ¶
type AccountGetter ¶
type AccountIterable ¶
type AccountUpdater ¶
type Cache ¶
func NewCache ¶
func NewCache(backend Reader, options ...CacheOption) *Cache
Returns a Cache that wraps an underlying Reader to use on a cache miss, can write to an output Writer via Sync. Goroutine safe for concurrent access.
func (*Cache) GetAccount ¶ added in v0.19.0
func (*Cache) GetStorage ¶ added in v0.19.0
func (*Cache) IterateCachedAccount ¶ added in v0.19.0
func (cache *Cache) IterateCachedAccount(consumer func(acm.Account) (stop bool)) (stopped bool, err error)
Iterates over all cached accounts first in cache and then in backend until consumer returns true for 'stop'
func (*Cache) IterateCachedStorage ¶ added in v0.19.0
func (cache *Cache) IterateCachedStorage(address crypto.Address, consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error)
Iterates over all cached storage items first in cache and then in backend until consumer returns true for 'stop'
func (*Cache) RemoveAccount ¶ added in v0.19.0
func (*Cache) Reset ¶
Resets the cache to empty initialising the backing map to the same size as the previous iteration.
func (*Cache) SetStorage ¶ added in v0.19.0
func (cache *Cache) SetStorage(address crypto.Address, key binary.Word256, value binary.Word256) error
NOTE: Set value to zero to remove.
type Iterable ¶
type Iterable interface { AccountIterable StorageIterable }
type IterableReader ¶ added in v0.19.0
Read and list account and storage state
type IterableReaderWriter ¶ added in v0.19.0
type MemoryState ¶
type MemoryState struct { Accounts map[crypto.Address]acm.Account Storage map[crypto.Address]map[binary.Word256]binary.Word256 }
func (*MemoryState) GetAccount ¶
func (*MemoryState) GetStorage ¶
func (*MemoryState) IterateAccounts ¶
func (*MemoryState) IterateStorage ¶
func (*MemoryState) RemoveAccount ¶
func (ms *MemoryState) RemoveAccount(address crypto.Address) error
func (*MemoryState) SetStorage ¶
func (*MemoryState) UpdateAccount ¶
func (ms *MemoryState) UpdateAccount(updatedAccount acm.Account) error
type Reader ¶
type Reader interface { AccountGetter StorageGetter }
Read-only account and storage state
type ReaderWriter ¶ added in v0.19.0
Read and write account and storage state
type StorageGetter ¶
type StorageIterable ¶
type StorageIterable interface { // Iterates through the storage of account ad address calling the passed function once per account, // if the iterator function returns true the iteration breaks and returns true to indicate it iteration // was escaped IterateStorage(address crypto.Address, consumer func(key, value binary.Word256) (stop bool)) (stopped bool, err error) }
type StorageSetter ¶
type Writer ¶
type Writer interface { AccountUpdater StorageSetter }