Documentation ¶
Index ¶
- type Cached
- func (cd *Cached) AppendNEP5Transfer(acc util.Uint160, index uint32, tr *state.NEP5Transfer) (bool, error)
- func (cd *Cached) AppendTransfer(acc util.Uint160, index uint32, tr *state.Transfer) (bool, error)
- func (cd *Cached) DeleteContractState(hash util.Uint160) error
- func (cd *Cached) DeleteStorageItem(scripthash util.Uint160, key []byte) error
- func (cd *Cached) FlushStorage() error
- func (cd *Cached) GetAccountState(hash util.Uint160) (*state.Account, error)
- func (cd *Cached) GetAccountStateOrNew(hash util.Uint160) (*state.Account, error)
- func (cd *Cached) GetContractState(hash util.Uint160) (*state.Contract, error)
- func (cd *Cached) GetNEP5Balances(acc util.Uint160) (*state.NEP5Balances, error)
- func (cd *Cached) GetNEP5TransferLog(acc util.Uint160, index uint32) (*state.TransferLog, error)
- func (cd *Cached) GetNextTransferBatch(acc util.Uint160) (uint32, error)
- func (cd *Cached) GetStorageItem(scripthash util.Uint160, key []byte) *state.StorageItem
- func (cd *Cached) GetStorageItems(hash util.Uint160, prefix []byte) ([]StorageItemWithKey, error)
- func (cd *Cached) GetStorageItemsIterator(hash util.Uint160, prefix []byte) (StorageIteratorFunc, error)
- func (cd *Cached) GetTransferLog(acc util.Uint160, index uint32) (*state.TransferLog, error)
- func (cd *Cached) GetUnspentCoinState(hash util.Uint256) (*state.UnspentCoin, error)
- func (cd *Cached) GetWrapped() DAO
- func (cd *Cached) MigrateNEP5Balances(from, to util.Uint160) error
- func (cd *Cached) Persist() (int, error)
- func (cd *Cached) PutAccountState(as *state.Account) error
- func (cd *Cached) PutContractState(cs *state.Contract) error
- func (cd *Cached) PutNEP5Balances(acc util.Uint160, bs *state.NEP5Balances) error
- func (cd *Cached) PutNEP5TransferLog(acc util.Uint160, index uint32, bs *state.TransferLog) error
- func (cd *Cached) PutNextTransferBatch(acc util.Uint160, num uint32) error
- func (cd *Cached) PutStorageItem(scripthash util.Uint160, key []byte, si *state.StorageItem) error
- func (cd *Cached) PutTransferLog(acc util.Uint160, index uint32, bs *state.TransferLog) error
- func (cd *Cached) PutUnspentCoinState(hash util.Uint256, ucs *state.UnspentCoin) error
- type DAO
- type Simple
- func (dao *Simple) AppendNEP5Transfer(acc util.Uint160, index uint32, tr *state.NEP5Transfer) (bool, error)
- func (dao *Simple) AppendTransfer(acc util.Uint160, index uint32, tr *state.Transfer) (bool, error)
- func (dao *Simple) DeleteContractState(hash util.Uint160) error
- func (dao *Simple) DeleteStorageItem(scripthash util.Uint160, key []byte) error
- func (dao *Simple) DeleteValidatorState(vs *state.Validator) error
- func (dao *Simple) GetAccountState(hash util.Uint160) (*state.Account, error)
- func (dao *Simple) GetAccountStateOrNew(hash util.Uint160) (*state.Account, error)
- func (dao *Simple) GetAndDecode(entity io.Serializable, key []byte) error
- func (dao *Simple) GetAppExecResult(hash util.Uint256) (*state.AppExecResult, error)
- func (dao *Simple) GetAssetState(assetID util.Uint256) (*state.Asset, error)
- func (dao *Simple) GetBatch() *storage.MemBatch
- func (dao *Simple) GetBlock(hash util.Uint256) (*block.Block, uint32, error)
- func (dao *Simple) GetContractState(hash util.Uint160) (*state.Contract, error)
- func (dao *Simple) GetCurrentBlockHeight() (uint32, error)
- func (dao *Simple) GetCurrentHeaderHeight() (i uint32, h util.Uint256, err error)
- func (dao *Simple) GetCurrentStateRootHeight() (uint32, error)
- func (dao *Simple) GetHeaderHashes() ([]util.Uint256, error)
- func (dao *Simple) GetNEP5Balances(acc util.Uint160) (*state.NEP5Balances, error)
- func (dao *Simple) GetNEP5Metadata(h util.Uint160) (*state.NEP5Metadata, error)
- func (dao *Simple) GetNEP5TransferLog(acc util.Uint160, index uint32) (*state.TransferLog, error)
- func (dao *Simple) GetNextTransferBatch(acc util.Uint160) (uint32, error)
- func (dao *Simple) GetStateRoot(height uint32) (*state.MPTRootState, error)
- func (dao *Simple) GetStorageItem(scripthash util.Uint160, key []byte) *state.StorageItem
- func (dao *Simple) GetStorageItems(hash util.Uint160, prefix []byte) ([]StorageItemWithKey, error)
- func (dao *Simple) GetTransaction(hash util.Uint256) (*transaction.Transaction, uint32, error)
- func (dao *Simple) GetTransferLog(acc util.Uint160, index uint32) (*state.TransferLog, error)
- func (dao *Simple) GetUnspentCoinState(hash util.Uint256) (*state.UnspentCoin, error)
- func (dao *Simple) GetValidatorState(publicKey *keys.PublicKey) (*state.Validator, error)
- func (dao *Simple) GetValidatorStateOrNew(publicKey *keys.PublicKey) (*state.Validator, error)
- func (dao *Simple) GetValidators() []*state.Validator
- func (dao *Simple) GetValidatorsCount() (*state.ValidatorsCount, error)
- func (dao *Simple) GetVersion() (string, error)
- func (dao *Simple) GetWrapped() DAO
- func (dao *Simple) HasTransaction(hash util.Uint256) bool
- func (dao *Simple) InitMPT(height uint32, enableRefCount bool) error
- func (dao *Simple) IsDoubleClaim(claim *transaction.ClaimTX) bool
- func (dao *Simple) IsDoubleSpend(tx *transaction.Transaction) bool
- func (dao *Simple) Persist() (int, error)
- func (dao *Simple) Put(entity io.Serializable, key []byte) error
- func (dao *Simple) PutAccountState(as *state.Account) error
- func (dao *Simple) PutAppExecResult(aer *state.AppExecResult) error
- func (dao *Simple) PutAssetState(as *state.Asset) error
- func (dao *Simple) PutContractState(cs *state.Contract) error
- func (dao *Simple) PutCurrentHeader(hashAndIndex []byte) error
- func (dao *Simple) PutCurrentStateRootHeight(height uint32) error
- func (dao *Simple) PutNEP5Balances(acc util.Uint160, bs *state.NEP5Balances) error
- func (dao *Simple) PutNEP5Metadata(h util.Uint160, m *state.NEP5Metadata) error
- func (dao *Simple) PutNEP5TransferLog(acc util.Uint160, index uint32, lg *state.TransferLog) error
- func (dao *Simple) PutNextTransferBatch(acc util.Uint160, num uint32) error
- func (dao *Simple) PutStateRoot(r *state.MPTRootState) error
- func (dao *Simple) PutStorageItem(scripthash util.Uint160, key []byte, si *state.StorageItem) error
- func (dao *Simple) PutTransferLog(acc util.Uint160, index uint32, lg *state.TransferLog) error
- func (dao *Simple) PutUnspentCoinState(hash util.Uint256, ucs *state.UnspentCoin) error
- func (dao *Simple) PutValidatorState(vs *state.Validator) error
- func (dao *Simple) PutValidatorsCount(vc *state.ValidatorsCount) error
- func (dao *Simple) PutVersion(v string) error
- func (dao *Simple) StoreAsBlock(block *block.Block, sysFee uint32) error
- func (dao *Simple) StoreAsCurrentBlock(block *block.Block) error
- func (dao *Simple) StoreAsTransaction(tx *transaction.Transaction, index uint32) error
- type StorageItemWithKey
- type StorageIteratorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cached ¶
type Cached struct { DAO // contains filtered or unexported fields }
Cached is a data access object that mimics DAO, but has a write cache for accounts and read cache for contracts. These are the most frequently used objects in the storeBlock().
func (*Cached) AppendNEP5Transfer ¶
func (cd *Cached) AppendNEP5Transfer(acc util.Uint160, index uint32, tr *state.NEP5Transfer) (bool, error)
AppendNEP5Transfer appends new transfer to a transfer event log.
func (*Cached) AppendTransfer ¶ added in v0.77.0
AppendTransfer appends new transfer to a transfer event log.
func (*Cached) DeleteContractState ¶
DeleteContractState deletes given contract state in cache and backing store.
func (*Cached) DeleteStorageItem ¶
DeleteStorageItem drops storage item for the given script with the given key from the store.
func (*Cached) FlushStorage ¶
FlushStorage flushes storage changes to the underlying DAO.
func (*Cached) GetAccountState ¶
GetAccountState retrieves Account from cache or underlying store.
func (*Cached) GetAccountStateOrNew ¶
GetAccountStateOrNew retrieves Account from cache or underlying store or creates a new one if it doesn't exist.
func (*Cached) GetContractState ¶
GetContractState returns contract state from cache or underlying store.
func (*Cached) GetNEP5Balances ¶
GetNEP5Balances retrieves NEP5Balances for the acc.
func (*Cached) GetNEP5TransferLog ¶
GetNEP5TransferLog retrieves TransferLog for the acc.
func (*Cached) GetNextTransferBatch ¶ added in v0.77.0
GetNextTransferBatch returns index for the transfer batch to write to.
func (*Cached) GetStorageItem ¶
GetStorageItem returns StorageItem if it exists in the given store.
func (*Cached) GetStorageItems ¶
GetStorageItems returns all storage items for a given scripthash.
func (*Cached) GetStorageItemsIterator ¶
func (cd *Cached) GetStorageItemsIterator(hash util.Uint160, prefix []byte) (StorageIteratorFunc, error)
GetStorageItemsIterator returns iterator over all storage items. Function returned can be called until first error.
func (*Cached) GetTransferLog ¶ added in v0.77.0
GetTransferLog retrieves TransferLog for the acc.
func (*Cached) GetUnspentCoinState ¶
GetUnspentCoinState retrieves UnspentCoin from cache or underlying store.
func (*Cached) MigrateNEP5Balances ¶ added in v0.76.1
MigrateNEP5Balances migrates NEP5 balances from old contract to the new one.
func (*Cached) Persist ¶
Persist flushes all the changes made into the (supposedly) persistent underlying store.
func (*Cached) PutAccountState ¶
PutAccountState saves given Account in the cache.
func (*Cached) PutContractState ¶
PutContractState puts given contract state into the given store.
func (*Cached) PutNEP5Balances ¶
PutNEP5Balances saves NEP5Balances for the acc.
func (*Cached) PutNEP5TransferLog ¶
PutNEP5TransferLog saves TransferLog for the acc.
func (*Cached) PutNextTransferBatch ¶ added in v0.77.0
PutNextTransferBatch sets index of the transfer batch to write to.
func (*Cached) PutStorageItem ¶
PutStorageItem puts given StorageItem for given script with given key into the given store.
func (*Cached) PutTransferLog ¶ added in v0.77.0
PutTransferLog saves TransferLog for the acc.
func (*Cached) PutUnspentCoinState ¶
PutUnspentCoinState saves given UnspentCoin in the cache.
type DAO ¶
type DAO interface { AppendNEP5Transfer(acc util.Uint160, index uint32, tr *state.NEP5Transfer) (bool, error) AppendTransfer(acc util.Uint160, index uint32, tr *state.Transfer) (bool, error) DeleteContractState(hash util.Uint160) error DeleteStorageItem(scripthash util.Uint160, key []byte) error DeleteValidatorState(vs *state.Validator) error GetAccountState(hash util.Uint160) (*state.Account, error) GetAccountStateOrNew(hash util.Uint160) (*state.Account, error) GetAndDecode(entity io.Serializable, key []byte) error GetAppExecResult(hash util.Uint256) (*state.AppExecResult, error) GetAssetState(assetID util.Uint256) (*state.Asset, error) GetBatch() *storage.MemBatch GetBlock(hash util.Uint256) (*block.Block, uint32, error) GetContractState(hash util.Uint160) (*state.Contract, error) GetCurrentBlockHeight() (uint32, error) GetCurrentHeaderHeight() (i uint32, h util.Uint256, err error) GetCurrentStateRootHeight() (uint32, error) GetHeaderHashes() ([]util.Uint256, error) GetNEP5Balances(acc util.Uint160) (*state.NEP5Balances, error) GetNEP5Metadata(h util.Uint160) (*state.NEP5Metadata, error) GetNEP5TransferLog(acc util.Uint160, index uint32) (*state.TransferLog, error) GetNextTransferBatch(acc util.Uint160) (uint32, error) GetStateRoot(height uint32) (*state.MPTRootState, error) PutStateRoot(root *state.MPTRootState) error GetStorageItem(scripthash util.Uint160, key []byte) *state.StorageItem GetStorageItems(hash util.Uint160, prefix []byte) ([]StorageItemWithKey, error) GetTransaction(hash util.Uint256) (*transaction.Transaction, uint32, error) GetTransferLog(acc util.Uint160, index uint32) (*state.TransferLog, error) GetUnspentCoinState(hash util.Uint256) (*state.UnspentCoin, error) GetValidatorState(publicKey *keys.PublicKey) (*state.Validator, error) GetValidatorStateOrNew(publicKey *keys.PublicKey) (*state.Validator, error) GetValidators() []*state.Validator GetValidatorsCount() (*state.ValidatorsCount, error) GetVersion() (string, error) GetWrapped() DAO HasTransaction(hash util.Uint256) bool IsDoubleClaim(claim *transaction.ClaimTX) bool IsDoubleSpend(tx *transaction.Transaction) bool Persist() (int, error) PutAccountState(as *state.Account) error PutAppExecResult(aer *state.AppExecResult) error PutAssetState(as *state.Asset) error PutContractState(cs *state.Contract) error PutCurrentHeader(hashAndIndex []byte) error PutNEP5Balances(acc util.Uint160, bs *state.NEP5Balances) error PutNEP5Metadata(h util.Uint160, meta *state.NEP5Metadata) error PutNEP5TransferLog(acc util.Uint160, index uint32, lg *state.TransferLog) error PutNextTransferBatch(acc util.Uint160, num uint32) error PutStorageItem(scripthash util.Uint160, key []byte, si *state.StorageItem) error PutTransferLog(acc util.Uint160, index uint32, lg *state.TransferLog) error PutUnspentCoinState(hash util.Uint256, ucs *state.UnspentCoin) error PutValidatorState(vs *state.Validator) error PutValidatorsCount(vc *state.ValidatorsCount) error PutVersion(v string) error StoreAsBlock(block *block.Block, sysFee uint32) error StoreAsCurrentBlock(block *block.Block) error StoreAsTransaction(tx *transaction.Transaction, index uint32) error // contains filtered or unexported methods }
DAO is a data access object.
type Simple ¶
type Simple struct { MPT *mpt.Trie Store *storage.MemCachedStore }
Simple is memCached wrapper around DB, simple DAO implementation.
func (*Simple) AppendNEP5Transfer ¶
func (dao *Simple) AppendNEP5Transfer(acc util.Uint160, index uint32, tr *state.NEP5Transfer) (bool, error)
AppendNEP5Transfer appends a single NEP5 transfer to a log. First return value signalizes that log size has exceeded batch size.
func (*Simple) AppendTransfer ¶ added in v0.77.0
AppendTransfer appends a single transfer to a log. First return value signalizes that log size has exceeded batch size.
func (*Simple) DeleteContractState ¶
DeleteContractState deletes given contract state in the given store.
func (*Simple) DeleteStorageItem ¶
DeleteStorageItem drops storage item for the given script with the given key from the store.
func (*Simple) DeleteValidatorState ¶
DeleteValidatorState deletes given Validator into the given store.
func (*Simple) GetAccountState ¶
GetAccountState returns Account from the given Store if it's present there. Returns nil otherwise.
func (*Simple) GetAccountStateOrNew ¶
GetAccountStateOrNew retrieves Account from temporary or persistent Store or creates a new one if it doesn't exist and persists it.
func (*Simple) GetAndDecode ¶
func (dao *Simple) GetAndDecode(entity io.Serializable, key []byte) error
GetAndDecode performs get operation and decoding with serializable structures.
func (*Simple) GetAppExecResult ¶
GetAppExecResult gets application execution result from the given store.
func (*Simple) GetAssetState ¶
GetAssetState returns given asset state as recorded in the given store.
func (*Simple) GetContractState ¶
GetContractState returns contract state as recorded in the given store by the given script hash.
func (*Simple) GetCurrentBlockHeight ¶
GetCurrentBlockHeight returns the current block height found in the underlying store.
func (*Simple) GetCurrentHeaderHeight ¶
GetCurrentHeaderHeight returns the current header height and hash from the underlying store.
func (*Simple) GetCurrentStateRootHeight ¶ added in v0.76.0
GetCurrentStateRootHeight returns current state root height.
func (*Simple) GetHeaderHashes ¶
GetHeaderHashes returns a sorted list of header hashes retrieved from the given underlying store.
func (*Simple) GetNEP5Balances ¶
GetNEP5Balances retrieves nep5 balances from the cache.
func (*Simple) GetNEP5Metadata ¶ added in v0.77.0
GetNEP5Metadata returns saved NEP5 metadata for the contract h.
func (*Simple) GetNEP5TransferLog ¶
GetNEP5TransferLog retrieves transfer log from the cache.
func (*Simple) GetNextTransferBatch ¶ added in v0.77.0
GetNextTransferBatch returns index for the transfer batch to write to.
func (*Simple) GetStateRoot ¶ added in v0.76.0
func (dao *Simple) GetStateRoot(height uint32) (*state.MPTRootState, error)
GetStateRoot returns state root of a given height.
func (*Simple) GetStorageItem ¶
GetStorageItem returns StorageItem if it exists in the given store.
func (*Simple) GetStorageItems ¶
GetStorageItems returns all storage items for a given scripthash.
func (*Simple) GetTransaction ¶
func (dao *Simple) GetTransaction(hash util.Uint256) (*transaction.Transaction, uint32, error)
GetTransaction returns Transaction and its height by the given hash if it exists in the store.
func (*Simple) GetTransferLog ¶ added in v0.77.0
GetTransferLog retrieves transfer log from the cache.
func (*Simple) GetUnspentCoinState ¶
GetUnspentCoinState retrieves UnspentCoinState from the given store.
func (*Simple) GetValidatorState ¶
GetValidatorState returns validator by publicKey.
func (*Simple) GetValidatorStateOrNew ¶
GetValidatorStateOrNew gets validator from store or created new one in case of error.
func (*Simple) GetValidators ¶
GetValidators returns all validators from store.
func (*Simple) GetValidatorsCount ¶
func (dao *Simple) GetValidatorsCount() (*state.ValidatorsCount, error)
GetValidatorsCount returns current ValidatorsCount or new one if there is none in the DB.
func (*Simple) GetVersion ¶
GetVersion attempts to get the current version stored in the underlying store.
func (*Simple) GetWrapped ¶
GetWrapped returns new DAO instance with another layer of wrapped MemCachedStore around the current DAO Store.
func (*Simple) HasTransaction ¶
HasTransaction returns true if the given store contains the given Transaction hash.
func (*Simple) IsDoubleClaim ¶
func (dao *Simple) IsDoubleClaim(claim *transaction.ClaimTX) bool
IsDoubleClaim verifies that given claim inputs are not already claimed by another tx.
func (*Simple) IsDoubleSpend ¶
func (dao *Simple) IsDoubleSpend(tx *transaction.Transaction) bool
IsDoubleSpend verifies that the input transactions are not double spent.
func (*Simple) Persist ¶
Persist flushes all the changes made into the (supposedly) persistent underlying store.
func (*Simple) Put ¶
func (dao *Simple) Put(entity io.Serializable, key []byte) error
Put performs put operation with serializable structures.
func (*Simple) PutAccountState ¶
PutAccountState saves given Account in given store.
func (*Simple) PutAppExecResult ¶
func (dao *Simple) PutAppExecResult(aer *state.AppExecResult) error
PutAppExecResult puts given application execution result into the given store.
func (*Simple) PutAssetState ¶
PutAssetState puts given asset state into the given store.
func (*Simple) PutContractState ¶
PutContractState puts given contract state into the given store.
func (*Simple) PutCurrentHeader ¶
PutCurrentHeader stores current header.
func (*Simple) PutCurrentStateRootHeight ¶ added in v0.76.0
PutCurrentStateRootHeight updates current state root height.
func (*Simple) PutNEP5Balances ¶
PutNEP5Balances saves nep5 balances from the cache.
func (*Simple) PutNEP5Metadata ¶ added in v0.77.0
PutNEP5Metadata saves NEP5 metadata for the contract h.
func (*Simple) PutNEP5TransferLog ¶
PutNEP5TransferLog saves given transfer log in the cache.
func (*Simple) PutNextTransferBatch ¶ added in v0.77.0
PutNextTransferBatch sets index of the transfer batch to write to.
func (*Simple) PutStateRoot ¶ added in v0.76.0
func (dao *Simple) PutStateRoot(r *state.MPTRootState) error
PutStateRoot puts state root of a given height into the store.
func (*Simple) PutStorageItem ¶
PutStorageItem puts given StorageItem for given script with given key into the given store.
func (*Simple) PutTransferLog ¶ added in v0.77.0
PutTransferLog saves given transfer log in the cache.
func (*Simple) PutUnspentCoinState ¶
PutUnspentCoinState puts given UnspentCoinState into the given store.
func (*Simple) PutValidatorState ¶
PutValidatorState puts given Validator into the given store.
func (*Simple) PutValidatorsCount ¶
func (dao *Simple) PutValidatorsCount(vc *state.ValidatorsCount) error
PutValidatorsCount put given ValidatorsCount in the store.
func (*Simple) PutVersion ¶
PutVersion stores the given version in the underlying store.
func (*Simple) StoreAsBlock ¶
StoreAsBlock stores the given block as DataBlock.
func (*Simple) StoreAsCurrentBlock ¶
StoreAsCurrentBlock stores the given block witch prefix SYSCurrentBlock.
func (*Simple) StoreAsTransaction ¶
func (dao *Simple) StoreAsTransaction(tx *transaction.Transaction, index uint32) error
StoreAsTransaction stores the given TX as DataTransaction.
type StorageItemWithKey ¶
type StorageItemWithKey struct { state.StorageItem Key []byte }
StorageItemWithKey is a Key-Value pair together with possible const modifier.
type StorageIteratorFunc ¶
StorageIteratorFunc is a function returning key-value pair or error.