Documentation
¶
Index ¶
- Variables
- type Simple
- func (dao *Simple) DeleteBlock(h util.Uint256) error
- func (dao *Simple) DeleteContractID(id int32)
- func (dao *Simple) DeleteStorageItem(id int32, key []byte)
- func (dao *Simple) GetAndDecode(entity io.Serializable, key []byte) error
- func (dao *Simple) GetAppExecResults(hash util.Uint256, trig trigger.Type) ([]state.AppExecResult, error)
- func (dao *Simple) GetBatch() *storage.MemBatch
- func (dao *Simple) GetBlock(hash util.Uint256) (*block.Block, error)
- func (dao *Simple) GetContractScriptHash(id int32) (util.Uint160, error)
- func (dao *Simple) GetCurrentBlockHeight() (uint32, error)
- func (dao *Simple) GetCurrentHeaderHeight() (i uint32, h util.Uint256, err error)
- func (dao *Simple) GetHeaderHashes() ([]util.Uint256, error)
- func (dao *Simple) GetPrivate() *Simple
- func (dao *Simple) GetStateSyncCurrentBlockHeight() (uint32, error)
- func (dao *Simple) GetStateSyncPoint() (uint32, error)
- func (dao *Simple) GetStorageItem(id int32, key []byte) state.StorageItem
- func (dao *Simple) GetStorageItems(id int32) ([]state.StorageItemWithKey, error)
- func (dao *Simple) GetStorageItemsWithPrefix(id int32, prefix []byte) ([]state.StorageItemWithKey, error)
- func (dao *Simple) GetTokenTransferInfo(acc util.Uint160) (*state.TokenTransferInfo, error)
- func (dao *Simple) GetTokenTransferLog(acc util.Uint160, newestTimestamp uint64, index uint32, isNEP11 bool) (*state.TokenTransferLog, error)
- func (dao *Simple) GetTransaction(hash util.Uint256) (*transaction.Transaction, uint32, error)
- func (dao *Simple) GetVersion() (Version, error)
- func (dao *Simple) GetWrapped() *Simple
- func (dao *Simple) HasTransaction(hash util.Uint256) error
- func (dao *Simple) Persist() (int, error)
- func (dao *Simple) PersistSync() (int, error)
- func (dao *Simple) PutContractID(id int32, hash util.Uint160)
- func (dao *Simple) PutCurrentHeader(h util.Uint256, index uint32)
- func (dao *Simple) PutStateSyncCurrentBlockHeight(h uint32)
- func (dao *Simple) PutStateSyncPoint(p uint32)
- func (dao *Simple) PutStorageItem(id int32, key []byte, si state.StorageItem)
- func (dao *Simple) PutTokenTransferInfo(acc util.Uint160, bs *state.TokenTransferInfo) error
- func (dao *Simple) PutTokenTransferLog(acc util.Uint160, start uint64, index uint32, isNEP11 bool, ...)
- func (dao *Simple) PutVersion(v Version)
- func (dao *Simple) Seek(id int32, rng storage.SeekRange, f func(k, v []byte) bool)
- func (dao *Simple) SeekAsync(ctx context.Context, id int32, rng storage.SeekRange) chan storage.KeyValue
- func (dao *Simple) SeekNEP11TransferLog(acc util.Uint160, newestTimestamp uint64, ...) error
- func (dao *Simple) SeekNEP17TransferLog(acc util.Uint160, newestTimestamp uint64, ...) error
- func (dao *Simple) StoreAsBlock(block *block.Block, aer1 *state.AppExecResult, aer2 *state.AppExecResult) error
- func (dao *Simple) StoreAsCurrentBlock(block *block.Block)
- func (dao *Simple) StoreAsTransaction(tx *transaction.Transaction, index uint32, aer *state.AppExecResult) error
- func (dao *Simple) StoreHeader(h *block.Header) error
- func (dao *Simple) StoreHeaderHashes(hashes []util.Uint256, height uint32) error
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAlreadyExists is returned when transaction exists in dao. ErrAlreadyExists = errors.New("transaction already exists") // ErrHasConflicts is returned when transaction is in the list of conflicting // transactions which are already in dao. ErrHasConflicts = errors.New("transaction has conflicts") )
HasTransaction errors.
Functions ¶
This section is empty.
Types ¶
type Simple ¶
type Simple struct { Version Version Store *storage.MemCachedStore // contains filtered or unexported fields }
Simple is memCached wrapper around DB, simple DAO implementation.
func (*Simple) DeleteBlock ¶ added in v0.92.0
DeleteBlock removes block from dao. It's not atomic, so make sure you're using private MemCached instance here.
func (*Simple) DeleteContractID ¶ added in v0.92.0
DeleteContractID deletes contract's id to hash mapping.
func (*Simple) DeleteStorageItem ¶
DeleteStorageItem drops storage item for the given id with the given key from the store.
func (*Simple) GetAndDecode ¶
func (dao *Simple) GetAndDecode(entity io.Serializable, key []byte) error
GetAndDecode performs get operation and decoding with serializable structures.
func (*Simple) GetAppExecResults ¶ added in v0.92.0
func (dao *Simple) GetAppExecResults(hash util.Uint256, trig trigger.Type) ([]state.AppExecResult, error)
GetAppExecResults gets application execution results with the specified trigger from the given store.
func (*Simple) GetContractScriptHash ¶ added in v0.91.0
GetContractScriptHash retrieves contract's hash given its ID.
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) GetHeaderHashes ¶
GetHeaderHashes returns a sorted list of header hashes retrieved from the given underlying store.
func (*Simple) GetPrivate ¶ added in v0.98.2
GetPrivate returns new DAO instance with another layer of private MemCachedStore around the current DAO Store.
func (*Simple) GetStateSyncCurrentBlockHeight ¶ added in v0.97.2
GetStateSyncCurrentBlockHeight returns current block height stored during state synchronisation process.
func (*Simple) GetStateSyncPoint ¶ added in v0.97.2
GetStateSyncPoint returns current state synchronisation point P.
func (*Simple) GetStorageItem ¶
func (dao *Simple) GetStorageItem(id int32, key []byte) state.StorageItem
GetStorageItem returns StorageItem if it exists in the given store.
func (*Simple) GetStorageItems ¶
func (dao *Simple) GetStorageItems(id int32) ([]state.StorageItemWithKey, error)
GetStorageItems returns all storage items for a given id.
func (*Simple) GetStorageItemsWithPrefix ¶ added in v0.90.0
func (dao *Simple) GetStorageItemsWithPrefix(id int32, prefix []byte) ([]state.StorageItemWithKey, error)
GetStorageItemsWithPrefix returns all storage items with given id for a given scripthash.
func (*Simple) GetTokenTransferInfo ¶ added in v0.98.0
GetTokenTransferInfo retrieves NEP-17 transfer info from the cache.
func (*Simple) GetTokenTransferLog ¶ added in v0.98.0
func (dao *Simple) GetTokenTransferLog(acc util.Uint160, newestTimestamp uint64, index uint32, isNEP11 bool) (*state.TokenTransferLog, error)
GetTokenTransferLog retrieves transfer log from the cache.
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. It does not return dummy transactions.
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 nil if the given store does not contain the given Transaction hash. It returns an error in case if transaction is in chain or in the list of conflicting transactions.
func (*Simple) Persist ¶
Persist flushes all the changes made into the (supposedly) persistent underlying store. It doesn't block accesses to DAO from other threads.
func (*Simple) PersistSync ¶ added in v0.98.0
PersistSync flushes all the changes made into the (supposedly) persistent underlying store. It's a synchronous version of Persist that doesn't allow other threads to work with DAO while flushing the Store.
func (*Simple) PutContractID ¶ added in v0.92.0
PutContractID adds a mapping from contract's ID to its hash.
func (*Simple) PutCurrentHeader ¶
PutCurrentHeader stores current header.
func (*Simple) PutStateSyncCurrentBlockHeight ¶ added in v0.97.2
PutStateSyncCurrentBlockHeight stores current block height during state synchronisation process.
func (*Simple) PutStateSyncPoint ¶ added in v0.97.2
PutStateSyncPoint stores current state synchronisation point P.
func (*Simple) PutStorageItem ¶
func (dao *Simple) PutStorageItem(id int32, key []byte, si state.StorageItem)
PutStorageItem puts given StorageItem for given id with given key into the given store.
func (*Simple) PutTokenTransferInfo ¶ added in v0.98.0
PutTokenTransferInfo saves NEP-17 transfer info in the cache.
func (*Simple) PutTokenTransferLog ¶ added in v0.98.0
func (dao *Simple) PutTokenTransferLog(acc util.Uint160, start uint64, index uint32, isNEP11 bool, lg *state.TokenTransferLog)
PutTokenTransferLog saves given transfer log in the cache.
func (*Simple) PutVersion ¶
PutVersion stores the given version in the underlying store.
func (*Simple) Seek ¶ added in v0.92.0
Seek executes f for all storage items matching a given `rng` (matching given prefix and starting from the point specified). If key or value is to be used outside of f, they may not be copied. Seek continues iterating until false is returned from f.
func (*Simple) SeekAsync ¶ added in v0.98.0
func (dao *Simple) SeekAsync(ctx context.Context, id int32, rng storage.SeekRange) chan storage.KeyValue
SeekAsync sends all storage items matching a given `rng` (matching given prefix and starting from the point specified) to a channel and returns the channel. Resulting keys and values may not be copied.
func (*Simple) SeekNEP11TransferLog ¶ added in v0.98.1
func (dao *Simple) SeekNEP11TransferLog(acc util.Uint160, newestTimestamp uint64, f func(*state.NEP11Transfer) (bool, error)) error
SeekNEP11TransferLog executes f for each NEP-11 transfer in log starting from the transfer with the newest timestamp up to the oldest transfer. It continues iteration until false is returned from f. The last non-nil error is returned.
func (*Simple) SeekNEP17TransferLog ¶ added in v0.98.1
func (dao *Simple) SeekNEP17TransferLog(acc util.Uint160, newestTimestamp uint64, f func(*state.NEP17Transfer) (bool, error)) error
SeekNEP17TransferLog executes f for each NEP-17 transfer in log starting from the transfer with the newest timestamp up to the oldest transfer. It continues iteration until false is returned from f. The last non-nil error is returned.
func (*Simple) StoreAsBlock ¶
func (dao *Simple) StoreAsBlock(block *block.Block, aer1 *state.AppExecResult, aer2 *state.AppExecResult) error
StoreAsBlock stores given block as DataBlock. It can reuse given buffer for the purpose of value serialization.
func (*Simple) StoreAsCurrentBlock ¶
StoreAsCurrentBlock stores a hash of the given block with prefix SYSCurrentBlock. It can reuse given buffer for the purpose of value serialization.
func (*Simple) StoreAsTransaction ¶
func (dao *Simple) StoreAsTransaction(tx *transaction.Transaction, index uint32, aer *state.AppExecResult) error
StoreAsTransaction stores given TX as DataTransaction. It also stores transactions given tx has conflicts with as DataTransaction with dummy version. It can reuse given buffer for the purpose of value serialization.
func (*Simple) StoreHeader ¶ added in v0.98.2
StoreHeader saves block header into the store.
type Version ¶ added in v0.98.0
type Version struct { StoragePrefix storage.KeyPrefix StateRootInHeader bool P2PSigExtensions bool P2PStateExchangeExtensions bool KeepOnlyLatestState bool Value string }
Version represents current dao version.