Documentation ¶
Index ¶
- Constants
- Variables
- type CacheDB
- func (self *CacheDB) CleanContractStorage(addr common.Address, height uint32) error
- func (self *CacheDB) CleanContractStorageData(addr common.Address) error
- func (self *CacheDB) Commit()
- func (self *CacheDB) DelEthAccount(addr ethcomm.Address)
- func (self *CacheDB) Delete(key []byte)
- func (self *CacheDB) DeleteContract(address common.Address, height uint32)
- func (self *CacheDB) GenAccountStateKey(addr common.Address, key []byte) []byte
- func (self *CacheDB) Get(key []byte) ([]byte, error)
- func (self *CacheDB) GetEthAccount(addr ethcomm.Address) (val EthAccount, err error)
- func (self *CacheDB) GetEthCode(codeHash ethcomm.Hash) (val []byte, err error)
- func (self *CacheDB) IsContractDestroyed(addr common.Address) (bool, error)
- func (self *CacheDB) MigrateContractStorage(oldAddress, newAddress common.Address, height uint32) error
- func (self *CacheDB) NewIterator(key []byte) storage.StoreIterator
- func (self *CacheDB) Put(key []byte, value []byte)
- func (self *CacheDB) PutEthAccount(addr ethcomm.Address, val EthAccount)
- func (self *CacheDB) PutEthCode(codeHash ethcomm.Hash, val []byte)
- func (self *CacheDB) Reset()
- func (self *CacheDB) SetContractDestroyed(addr common.Address, height uint32)
- func (self *CacheDB) SetDbErr(err error)
- func (self *CacheDB) UnsetContractDestroyed(addr common.Address, height uint32)
- type Dummy
- func (d Dummy) AddBalance(cache *CacheDB, addr common.Address, val *big.Int) error
- func (d Dummy) GetBalance(cache *CacheDB, addr common.Address) (*big.Int, error)
- func (d Dummy) SetBalance(cache *CacheDB, addr common.Address, val *big.Int) error
- func (d Dummy) SubBalance(cache *CacheDB, addr common.Address, val *big.Int) error
- type EthAccount
- type Iter
- type JoinIter
- type KeyOrigin
- type MemDB
- func (p *MemDB) Capacity() int
- func (self *MemDB) DeepClone() *MemDB
- func (p *MemDB) Delete(key []byte)
- func (p *MemDB) Find(key []byte) (rkey, value []byte, err error)
- func (p *MemDB) ForEach(f func(key, val []byte))
- func (p *MemDB) Free() int
- func (p *MemDB) Get(key []byte) (value []byte, unkown bool)
- func (p *MemDB) Len() int
- func (p *MemDB) NewIterator(slice *util.Range) iterator.Iterator
- func (p *MemDB) Put(key []byte, value []byte)
- func (p *MemDB) Reset()
- func (p *MemDB) Size() int
- type OngBalanceHandle
- type StateDB
- func (self *StateDB) AddBalance(addr ethcomm.Address, val *big.Int)
- func (self *StateDB) AddLog(log *common.StorageLog)
- func (self *StateDB) AddPreimage(ethcomm.Hash, []byte)
- func (self *StateDB) AddRefund(gas uint64)
- func (self *StateDB) BlockHash() ethcomm.Hash
- func (self *StateDB) Commit() error
- func (self *StateDB) CommitToCacheDB() error
- func (self *StateDB) CreateAccount(address ethcomm.Address)
- func (self *StateDB) Empty(addr ethcomm.Address) bool
- func (self *StateDB) Exist(addr ethcomm.Address) bool
- func (self *StateDB) ForEachStorage(ethcomm.Address, func(ethcomm.Hash, ethcomm.Hash) bool) error
- func (self *StateDB) GetBalance(addr ethcomm.Address) *big.Int
- func (self *StateDB) GetCode(addr ethcomm.Address) []byte
- func (self *StateDB) GetCodeHash(addr ethcomm.Address) (hash ethcomm.Hash)
- func (self *StateDB) GetCodeSize(addr ethcomm.Address) int
- func (self *StateDB) GetCommittedState(addr ethcomm.Address, key ethcomm.Hash) ethcomm.Hash
- func (self *StateDB) GetLogs() []*common.StorageLog
- func (self *StateDB) GetNonce(addr ethcomm.Address) uint64
- func (self *StateDB) GetRefund() uint64
- func (self *StateDB) GetState(contract ethcomm.Address, key ethcomm.Hash) ethcomm.Hash
- func (self *StateDB) HasSuicided(addr ethcomm.Address) bool
- func (self *StateDB) Prepare(thash, bhash ethcomm.Hash)
- func (self *StateDB) RevertToSnapshot(idx int)
- func (self *StateDB) SetCode(addr ethcomm.Address, code []byte)
- func (self *StateDB) SetNonce(addr ethcomm.Address, nonce uint64)
- func (self *StateDB) SetState(contract ethcomm.Address, key, value ethcomm.Hash)
- func (self *StateDB) Snapshot() int
- func (self *StateDB) SubBalance(addr ethcomm.Address, val *big.Int)
- func (self *StateDB) SubRefund(gas uint64)
- func (self *StateDB) Suicide(addr ethcomm.Address) bool
Constants ¶
const ( FromMem KeyOrigin = iota FromBack = iota FromBoth = iota )
Variables ¶
var ( ErrNotFound = errors.ErrNotFound ErrIterReleased = errors.New("leveldb/memdb: iterator released") )
Common errors.
Functions ¶
This section is empty.
Types ¶
type CacheDB ¶
type CacheDB struct {
// contains filtered or unexported fields
}
CacheDB is smart contract execute cache, it contains transaction cache and block cache When smart contract execute finish, need to commit transaction cache to block cache
func NewCacheDB ¶
func NewCacheDB(store storage.PersistStore) *CacheDB
NewCacheDB return a new contract cache
func (*CacheDB) CleanContractStorage ¶
func (*CacheDB) CleanContractStorageData ¶
func (*CacheDB) Commit ¶
func (self *CacheDB) Commit()
Commit current transaction cache to block cache
func (*CacheDB) DelEthAccount ¶
func (*CacheDB) DeleteContract ¶
func (*CacheDB) GenAccountStateKey ¶
func (*CacheDB) GetEthAccount ¶
func (self *CacheDB) GetEthAccount(addr ethcomm.Address) (val EthAccount, err error)
func (*CacheDB) GetEthCode ¶
func (*CacheDB) IsContractDestroyed ¶
func (*CacheDB) MigrateContractStorage ¶
func (*CacheDB) NewIterator ¶
func (self *CacheDB) NewIterator(key []byte) storage.StoreIterator
func (*CacheDB) PutEthAccount ¶
func (self *CacheDB) PutEthAccount(addr ethcomm.Address, val EthAccount)
func (*CacheDB) SetContractDestroyed ¶
type EthAccount ¶
func (*EthAccount) Deserialization ¶
func (self *EthAccount) Deserialization(source *common.ZeroCopySource) error
func (*EthAccount) IsEmpty ¶
func (self *EthAccount) IsEmpty() bool
func (*EthAccount) IsEmptyContract ¶
func (self *EthAccount) IsEmptyContract() bool
func (*EthAccount) Serialization ¶
func (self *EthAccount) Serialization(sink *common.ZeroCopySink)
type JoinIter ¶
type JoinIter struct {
// contains filtered or unexported fields
}
func NewJoinIter ¶
func NewJoinIter(memIter, backendIter storage.StoreIterator) *JoinIter
type MemDB ¶
type MemDB struct {
// contains filtered or unexported fields
}
MemDB is an in-memdb key/value database.
func NewMemDB ¶
NewMemDB creates a new initialized in-memdb key/value MemDB. The capacity is the initial key/value buffer capacity. The capacity is advisory, not enforced.
This MemDB is append-only, deleting an entry would remove entry node but not reclaim KV buffer.
The returned MemDB instance is safe for concurrent use.
func (*MemDB) Delete ¶
Delete deletes the value for the given key.
It is safe to modify the contents of the arguments after Delete returns.
func (*MemDB) Find ¶
Find finds key/value pair whose key is greater than or equal to the given key. It returns ErrNotFound if the table doesn't contain such pair.
The caller should not modify the contents of the returned slice, but it is safe to modify the contents of the argument after Find returns.
func (*MemDB) Get ¶
Get gets the value for the given key. It returns unkown == true if the MemDB does not contain the key. It returns nil, false if MemDB has deleted the key
The caller should not modify the contents of the returned slice, but it is safe to modify the contents of the argument after Get returns.
func (*MemDB) NewIterator ¶
NewIterator returns an iterator of the MemDB. The returned iterator is not safe for concurrent use, but it is safe to use multiple iterators concurrently, with each in a dedicated goroutine. It is also safe to use an iterator concurrently with modifying its underlying MemDB. However, the resultant key/value pairs are not guaranteed to be a consistent snapshot of the MemDB at a particular point in time.
Slice allows slicing the iterator to only contains keys in the given range. A nil Range.Start is treated as a key before all keys in the MemDB. And a nil Range.Limit is treated as a key after all keys in the MemDB.
The iterator must be released after use, by calling Release method.
Also read Iterator documentation of the leveldb/iterator package.
func (*MemDB) Put ¶
Put sets the value for the given key. It overwrites any previous value for that key; a MemDB is not a multi-map.
It is safe to modify the contents of the arguments after Put returns.
type OngBalanceHandle ¶
type OngBalanceHandle interface { SubBalance(cache *CacheDB, addr common.Address, val *big.Int) error AddBalance(cache *CacheDB, addr common.Address, val *big.Int) error SetBalance(cache *CacheDB, addr common.Address, val *big.Int) error GetBalance(cache *CacheDB, addr common.Address) (*big.Int, error) }
type StateDB ¶
type StateDB struct { Suicided map[ethcomm.Address]bool OngBalanceHandle OngBalanceHandle // contains filtered or unexported fields }
func NewStateDB ¶
func NewStateDB(cacheDB *CacheDB, thash, bhash ethcomm.Hash, balanceHandle OngBalanceHandle) *StateDB
func (*StateDB) AddLog ¶
func (self *StateDB) AddLog(log *common.StorageLog)
func (*StateDB) CommitToCacheDB ¶
func (*StateDB) CreateAccount ¶
func (*StateDB) ForEachStorage ¶
func (*StateDB) GetCodeHash ¶
func (*StateDB) GetCommittedState ¶
func (*StateDB) GetLogs ¶
func (self *StateDB) GetLogs() []*common.StorageLog