Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChunkReader ¶
type ChunkReader interface { // Read a block, return io.EOF if reach end, the block maybe a accountBlock or a snapshotBlock Read() (accountBlock *core.AccountBlock, snapshotBlock *core.SnapshotBlock, err error) // Close the stream Close() error Size() int64 Verified() bool Verify() }
type GenResult ¶
type GenResult struct { VMBlock *VmAccountBlock IsRetry bool Err error }
GenResult represents the result of a block being validated by vm.
type Generator ¶
type Generator interface { GenerateWithBlock(block *core.AccountBlock, fromBlock *core.AccountBlock) (*GenResult, error) GenerateWithMessage(message *IncomingMessage, producer *types.Address, signFunc SignFunc) (*GenResult, error) GenerateWithOnRoad(sendBlock *core.AccountBlock, producer *types.Address, signFunc SignFunc, difficulty *big.Int) (*GenResult, error) GetVMDB() VmDb }
type IncomingMessage ¶
type IncomingMessage struct { BlockType byte AccountAddress types.Address ToAddress *types.Address FromBlockHash *types.Hash TokenId *types.TokenTypeId Amount *big.Int Fee *big.Int Data []byte Difficulty *big.Int }
IncomingMessage carries the necessary transaction info.
type LedgerReader ¶
type LedgerReader interface { Seg() Segment Size() int io.ReadCloser }
type Segment ¶
type SegmentList ¶
type SegmentList []Segment
func (SegmentList) Len ¶
func (list SegmentList) Len() int
func (SegmentList) Less ¶
func (list SegmentList) Less(i, j int) bool
func (SegmentList) Swap ¶
func (list SegmentList) Swap(i, j int)
type SignFunc ¶
SignFunc is the function type defining the callback when a block requires a method to sign the transaction in generator.
type StateSnapshot ¶
type StateSnapshot interface { // ====== balance ====== GetBalance(tokenId *types.TokenTypeId) (*big.Int, error) // ====== Storage ====== GetValue([]byte) ([]byte, error) NewStorageIterator(prefix []byte) StorageIterator Release() }
type StorageIterator ¶
type SyncCache ¶
type SyncCache interface { NewWriter(segment Segment, size int64) (io.WriteCloser, error) Chunks() SegmentList NewReader(segment Segment) (ChunkReader, error) Delete(seg Segment) error Close() error }
type VerifyFunc ¶
VerifyFunc is the function
type VmAccountBlock ¶
type VmAccountBlock struct { AccountBlock *core.AccountBlock VmDb VmDb }
type VmDb ¶
type VmDb interface { // ====== Context ====== CanWrite() bool Address() *types.Address LatestSnapshotBlock() (*core.SnapshotBlock, error) PrevAccountBlock() (*core.AccountBlock, error) GetLatestAccountBlock(addr types.Address) (*core.AccountBlock, error) GetCallDepth(sendBlockHash *types.Hash) (uint16, error) GetQuotaUsedList(addr types.Address) []types.QuotaInfo GetGlobalQuota() types.QuotaInfo // ====== State ====== GetReceiptHash() *types.Hash Reset() // Release memory used in runtime. Finish() // ====== Storage ====== GetValue(key []byte) ([]byte, error) GetOriginalValue(key []byte) ([]byte, error) SetValue(key []byte, value []byte) error NewStorageIterator(prefix []byte) (StorageIterator, error) GetUnsavedStorage() [][2][]byte // ====== Balance ====== GetBalance(tokenTypeId *types.TokenTypeId) (*big.Int, error) SetBalance(tokenTypeId *types.TokenTypeId, amount *big.Int) GetUnsavedBalanceMap() map[types.TokenTypeId]*big.Int // ====== VMLog ====== AddLog(log *core.VmLog) GetLogList() core.VmLogList GetHistoryLogList(logHash *types.Hash) (core.VmLogList, error) GetLogListHash() *types.Hash // ====== AccountBlock ====== GetUnconfirmedBlocks(address types.Address) []*core.AccountBlock // ====== SnapshotBlock ====== GetGenesisSnapshotBlock() *core.SnapshotBlock GetConfirmSnapshotHeader(blockHash types.Hash) (*core.SnapshotBlock, error) GetConfirmedTimes(blockHash types.Hash) (uint64, error) GetSnapshotBlockByHeight(height uint64) (*core.SnapshotBlock, error) // ====== Meta & Code ====== SetContractMeta(toAddr types.Address, meta *core.ContractMeta) GetContractMeta() (*core.ContractMeta, error) GetContractMetaInSnapshot(contractAddress types.Address, snapshotBlock *core.SnapshotBlock) (meta *core.ContractMeta, err error) SetContractCode(code []byte) GetContractCode() ([]byte, error) GetContractCodeBySnapshotBlock(addr *types.Address, snapshotBlock *core.SnapshotBlock) ([]byte, error) // TODO GetUnsavedContractMeta() map[types.Address]*core.ContractMeta GetUnsavedContractCode() []byte // ====== built-in contract ====== GetStakeBeneficialAmount(addr *types.Address) (*big.Int, error) // ====== debug ====== DebugGetStorage() (map[string][]byte, error) }
Click to show internal directories.
Click to hide internal directories.