Documentation ¶
Index ¶
- func GlobalAccountPermissions(getter AccountGetter) (permission.AccountPermissions, error)
- type AccountGetter
- type AccountIterable
- type AccountStats
- type AccountStatsGetter
- type AccountUpdater
- type Cache
- func (cache *Cache) GetAccount(address crypto.Address) (*acm.Account, error)
- func (cache *Cache) GetStorage(address crypto.Address, key binary.Word256) ([]byte, 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 binary.Word256, value []byte) error) 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 []byte) error
- func (cache *Cache) String() string
- func (cache *Cache) Sync(st Writer) error
- func (cache *Cache) UpdateAccount(account *acm.Account) error
- type CacheOption
- type CodeHash
- type DumpState
- type Iterable
- type IterableReader
- type IterableReaderWriter
- type IterableStatsReader
- type MemoryState
- func (ms *MemoryState) GetAccount(address crypto.Address) (*acm.Account, error)
- func (ms *MemoryState) GetMetadata(metahash MetadataHash) (string, error)
- func (ms *MemoryState) GetStorage(address crypto.Address, key binary.Word256) ([]byte, error)
- func (ms *MemoryState) IterateAccounts(consumer func(*acm.Account) error) (err error)
- func (ms *MemoryState) IterateStorage(address crypto.Address, consumer func(key binary.Word256, value []byte) error) (err error)
- func (ms *MemoryState) RemoveAccount(address crypto.Address) error
- func (ms *MemoryState) SetMetadata(metahash MetadataHash, metadata string) error
- func (ms *MemoryState) SetStorage(address crypto.Address, key binary.Word256, value []byte) error
- func (ms *MemoryState) UpdateAccount(updatedAccount *acm.Account) error
- type MetadataCache
- type MetadataHash
- type MetadataReader
- type MetadataReaderWriter
- type MetadataWriter
- type Reader
- type ReaderWriter
- type StorageGetter
- type StorageIterable
- type StorageSetter
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlobalAccountPermissions ¶
func GlobalAccountPermissions(getter AccountGetter) (permission.AccountPermissions, error)
Get global permissions from the account at GlobalPermissionsAddress
Types ¶
type AccountGetter ¶
type AccountIterable ¶
type AccountStats ¶
type AccountStatsGetter ¶
type AccountStatsGetter interface {
GetAccountStats() AccountStats
}
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 ¶
func (*Cache) GetStorage ¶
func (*Cache) IterateCachedAccount ¶
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 ¶
func (cache *Cache) IterateCachedStorage(address crypto.Address, consumer func(key binary.Word256, value []byte) error) error
Iterates over all cached storage items first in cache and then in backend until consumer returns true for 'stop'
func (*Cache) Reset ¶
Resets the cache to empty initialising the backing map to the same size as the previous iteration.
func (*Cache) SetStorage ¶
NOTE: Set value to zero to remove.
type CacheOption ¶
var ReadOnly CacheOption = func(cache *Cache) *Cache { cache.readonly = true return cache }
func Named ¶
func Named(name string) CacheOption
type CodeHash ¶ added in v0.28.0
type CodeHash [32]byte
CodeHash is the keccak hash for the code for an account. This is used for the EVM CODEHASH opcode, and to find the correct Metadata for a contract
func (CodeHash) MarshalText ¶ added in v0.28.0
func (*CodeHash) UnmarshalText ¶ added in v0.28.0
type DumpState ¶
func (*DumpState) SetStorage ¶
type Iterable ¶
type Iterable interface { AccountIterable StorageIterable }
type IterableReader ¶
Read and list account and storage state
type IterableReaderWriter ¶
type IterableStatsReader ¶
type IterableStatsReader interface { Iterable Reader AccountStatsGetter }
type MemoryState ¶
type MemoryState struct { Accounts map[crypto.Address]*acm.Account Storage map[crypto.Address]map[binary.Word256][]byte Metadata map[MetadataHash]string }
func (*MemoryState) GetAccount ¶
func (*MemoryState) GetMetadata ¶ added in v0.28.0
func (ms *MemoryState) GetMetadata(metahash MetadataHash) (string, error)
func (*MemoryState) GetStorage ¶
func (*MemoryState) IterateAccounts ¶
func (ms *MemoryState) IterateAccounts(consumer func(*acm.Account) error) (err error)
func (*MemoryState) IterateStorage ¶
func (*MemoryState) RemoveAccount ¶
func (ms *MemoryState) RemoveAccount(address crypto.Address) error
func (*MemoryState) SetMetadata ¶ added in v0.28.0
func (ms *MemoryState) SetMetadata(metahash MetadataHash, metadata string) error
func (*MemoryState) SetStorage ¶
func (*MemoryState) UpdateAccount ¶
func (ms *MemoryState) UpdateAccount(updatedAccount *acm.Account) error
type MetadataCache ¶ added in v0.29.1
type MetadataCache struct {
// contains filtered or unexported fields
}
func NewMetadataCache ¶ added in v0.29.1
func NewMetadataCache(backend MetadataReader) *MetadataCache
func (*MetadataCache) GetMetadata ¶ added in v0.29.1
func (cache *MetadataCache) GetMetadata(metahash MetadataHash) (string, error)
func (*MetadataCache) Reset ¶ added in v0.30.5
func (cache *MetadataCache) Reset(backend MetadataReader)
func (*MetadataCache) SetMetadata ¶ added in v0.29.1
func (cache *MetadataCache) SetMetadata(metahash MetadataHash, metadata string) error
func (*MetadataCache) Sync ¶ added in v0.29.1
func (cache *MetadataCache) Sync(st MetadataWriter) error
Syncs changes to the backend in deterministic order. Sends storage updates before updating the account they belong so that storage values can be taken account of in the update.
type MetadataHash ¶ added in v0.28.0
type MetadataHash [32]byte
MetadataHash is the keccak hash for the metadata. This is to make the metadata content-addressed
func GetMetadataHash ¶ added in v0.28.0
func GetMetadataHash(metadata string) (metahash MetadataHash)
func (*MetadataHash) Bytes ¶ added in v0.28.0
func (h *MetadataHash) Bytes() []byte
func (MetadataHash) MarshalText ¶ added in v0.28.0
func (ch MetadataHash) MarshalText() ([]byte, error)
func (MetadataHash) String ¶ added in v0.28.0
func (ch MetadataHash) String() string
func (*MetadataHash) UnmarshalText ¶ added in v0.28.0
func (ch *MetadataHash) UnmarshalText(hexBytes []byte) error
type MetadataReader ¶ added in v0.29.1
type MetadataReader interface { // Get an Metadata by its hash. This is content-addressed GetMetadata(metahash MetadataHash) (string, error) }
type MetadataReaderWriter ¶ added in v0.29.1
type MetadataReaderWriter interface { MetadataReader MetadataWriter }
type MetadataWriter ¶ added in v0.29.1
type MetadataWriter interface { // Set an Metadata according to it keccak-256 hash. SetMetadata(metahash MetadataHash, metadata string) error }
type Reader ¶
type Reader interface { AccountGetter StorageGetter }
Read-only account and storage state
type ReaderWriter ¶
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 binary.Word256, value []byte) error) (err error) }
type StorageSetter ¶
type Writer ¶
type Writer interface { AccountUpdater StorageSetter }