storage

package
v1.14.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2021 License: LGPL-3.0 Imports: 12 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheDB added in v1.5.1

type CacheDB struct {
	// contains filtered or unexported fields
}

CacheDB is smart contract execute cache, it contain transaction cache and block cache When smart contract execute finish, need to commit transaction cache to block cache

func NewCacheDB added in v1.5.1

func NewCacheDB(store *overlaydb.OverlayDB) *CacheDB

NewCacheDB return a new contract cache

func (*CacheDB) CleanContractStorage added in v1.13.0

func (self *CacheDB) CleanContractStorage(addr comm.Address, height uint32) error

func (*CacheDB) CleanContractStorageData added in v1.14.1

func (self *CacheDB) CleanContractStorageData(addr comm.Address) error

func (*CacheDB) Commit added in v1.5.1

func (self *CacheDB) Commit()

Commit current transaction cache to block cache

func (*CacheDB) DelEthAccount added in v1.14.1

func (self *CacheDB) DelEthAccount(addr common.Address)

func (*CacheDB) Delete added in v1.5.1

func (self *CacheDB) Delete(key []byte)

func (*CacheDB) DeleteContract added in v1.5.1

func (self *CacheDB) DeleteContract(address comm.Address, height uint32)

func (*CacheDB) GenAccountStateKey added in v1.14.1

func (self *CacheDB) GenAccountStateKey(addr comm.Address, key []byte) []byte

func (*CacheDB) Get added in v1.5.1

func (self *CacheDB) Get(key []byte) ([]byte, error)

func (*CacheDB) GetContract added in v1.5.1

func (self *CacheDB) GetContract(addr comm.Address) (*payload.DeployCode, bool, error)

func (*CacheDB) GetEthAccount added in v1.14.1

func (self *CacheDB) GetEthAccount(addr common.Address) (val EthAccount, err error)

func (*CacheDB) GetEthCode added in v1.14.1

func (self *CacheDB) GetEthCode(codeHash common.Hash) (val []byte, err error)

func (*CacheDB) IsContractDestroyed added in v1.13.0

func (self *CacheDB) IsContractDestroyed(addr comm.Address) (bool, error)

func (*CacheDB) MigrateContractStorage added in v1.13.0

func (self *CacheDB) MigrateContractStorage(oldAddress, newAddress comm.Address, height uint32) error

func (*CacheDB) NewIterator added in v1.5.1

func (self *CacheDB) NewIterator(key []byte) common.StoreIterator

func (*CacheDB) Put added in v1.5.1

func (self *CacheDB) Put(key []byte, value []byte)

func (*CacheDB) PutContract added in v1.5.1

func (self *CacheDB) PutContract(contract *payload.DeployCode)

func (*CacheDB) PutEthAccount added in v1.14.1

func (self *CacheDB) PutEthAccount(addr common.Address, val EthAccount)

func (*CacheDB) PutEthCode added in v1.14.1

func (self *CacheDB) PutEthCode(codeHash common.Hash, val []byte)

func (*CacheDB) Reset added in v1.6.0

func (self *CacheDB) Reset()

func (*CacheDB) SetContractDestroyed added in v1.13.0

func (self *CacheDB) SetContractDestroyed(addr comm.Address, height uint32)

func (*CacheDB) SetDbErr added in v1.14.1

func (self *CacheDB) SetDbErr(err error)

func (*CacheDB) UnsetContractDestroyed added in v1.13.0

func (self *CacheDB) UnsetContractDestroyed(addr comm.Address, height uint32)

type EthAccount added in v1.14.1

type EthAccount struct {
	Nonce    uint64
	CodeHash common.Hash
}

func (*EthAccount) Deserialization added in v1.14.1

func (self *EthAccount) Deserialization(source *comm.ZeroCopySource) error

func (*EthAccount) IsEmpty added in v1.14.1

func (self *EthAccount) IsEmpty() bool

func (*EthAccount) Serialization added in v1.14.1

func (self *EthAccount) Serialization(sink *comm.ZeroCopySink)

type Iter added in v1.5.1

type Iter struct {
	*overlaydb.JoinIter
}

func (*Iter) Key added in v1.5.1

func (self *Iter) Key() []byte

type OngBalanceHandle added in v1.14.1

type OngBalanceHandle interface {
	SubBalance(cache *CacheDB, addr comm.Address, val *big.Int) error
	AddBalance(cache *CacheDB, addr comm.Address, val *big.Int) error
	SetBalance(cache *CacheDB, addr comm.Address, val *big.Int) error
	GetBalance(cache *CacheDB, addr comm.Address) (*big.Int, error)
}

type StateDB added in v1.14.1

type StateDB struct {
	Suicided map[common.Address]bool

	OngBalanceHandle OngBalanceHandle
	// contains filtered or unexported fields
}

func NewStateDB added in v1.14.1

func NewStateDB(cacheDB *CacheDB, thash, bhash common.Hash, balanceHandle OngBalanceHandle) *StateDB

func (*StateDB) AddBalance added in v1.14.1

func (self *StateDB) AddBalance(addr common.Address, val *big.Int)

func (*StateDB) AddLog added in v1.14.1

func (self *StateDB) AddLog(log *types.StorageLog)

func (*StateDB) AddPreimage added in v1.14.1

func (self *StateDB) AddPreimage(common.Hash, []byte)

func (*StateDB) AddRefund added in v1.14.1

func (self *StateDB) AddRefund(gas uint64)

func (*StateDB) BlockHash added in v1.14.1

func (self *StateDB) BlockHash() common.Hash

func (*StateDB) Commit added in v1.14.1

func (self *StateDB) Commit() error

func (*StateDB) CommitToCacheDB added in v1.14.1

func (self *StateDB) CommitToCacheDB() error

func (*StateDB) CreateAccount added in v1.14.1

func (self *StateDB) CreateAccount(address common.Address)

func (*StateDB) DbErr added in v1.14.1

func (self *StateDB) DbErr() error

func (*StateDB) Empty added in v1.14.1

func (self *StateDB) Empty(addr common.Address) bool

func (*StateDB) Exist added in v1.14.1

func (self *StateDB) Exist(addr common.Address) bool

func (*StateDB) ForEachStorage added in v1.14.1

func (self *StateDB) ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) error

func (*StateDB) GetBalance added in v1.14.1

func (self *StateDB) GetBalance(addr common.Address) *big.Int

func (*StateDB) GetCode added in v1.14.1

func (self *StateDB) GetCode(addr common.Address) []byte

func (*StateDB) GetCodeHash added in v1.14.1

func (self *StateDB) GetCodeHash(addr common.Address) (hash common.Hash)

func (*StateDB) GetCodeSize added in v1.14.1

func (self *StateDB) GetCodeSize(addr common.Address) int

func (*StateDB) GetCommittedState added in v1.14.1

func (self *StateDB) GetCommittedState(addr common.Address, key common.Hash) common.Hash

func (*StateDB) GetLogs added in v1.14.1

func (self *StateDB) GetLogs() []*types.StorageLog

func (*StateDB) GetNonce added in v1.14.1

func (self *StateDB) GetNonce(addr common.Address) uint64

func (*StateDB) GetRefund added in v1.14.1

func (self *StateDB) GetRefund() uint64

GetRefund returns the current value of the refund counter.

func (*StateDB) GetState added in v1.14.1

func (self *StateDB) GetState(contract common.Address, key common.Hash) common.Hash

func (*StateDB) HasSuicided added in v1.14.1

func (self *StateDB) HasSuicided(addr common.Address) bool

func (*StateDB) Prepare added in v1.14.1

func (self *StateDB) Prepare(thash, bhash common.Hash)

func (*StateDB) RevertToSnapshot added in v1.14.1

func (self *StateDB) RevertToSnapshot(idx int)

func (*StateDB) SetCode added in v1.14.1

func (self *StateDB) SetCode(addr common.Address, code []byte)

func (*StateDB) SetNonce added in v1.14.1

func (self *StateDB) SetNonce(addr common.Address, nonce uint64)

func (*StateDB) SetState added in v1.14.1

func (self *StateDB) SetState(contract common.Address, key, value common.Hash)

func (*StateDB) Snapshot added in v1.14.1

func (self *StateDB) Snapshot() int

func (*StateDB) SubBalance added in v1.14.1

func (self *StateDB) SubBalance(addr common.Address, val *big.Int)

func (*StateDB) SubRefund added in v1.14.1

func (self *StateDB) SubRefund(gas uint64)

SubRefund removes gas from the refund counter. This method will panic if the refund counter goes below zero

func (*StateDB) Suicide added in v1.14.1

func (self *StateDB) Suicide(addr common.Address) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL