Documentation ¶
Index ¶
- Constants
- Variables
- func ExcludePairTrades(chain JudgeGenesis, blockList []*ledger.AccountBlock) map[types.Address][]*ledger.AccountBlock
- type ContractTaskProcessor
- type ContractWorker
- func (w *ContractWorker) Close() error
- func (w *ContractWorker) GetStakeQuota(addr types.Address) uint64
- func (w *ContractWorker) GetStakeQuotas(beneficialList []types.Address) map[types.Address]uint64
- func (w *ContractWorker) Start(accEvent producerevent.AccountStartEvent)
- func (w ContractWorker) Status() int
- func (w *ContractWorker) Stop()
- type JudgeGenesis
- type Manager
- func (manager Manager) Chain() chain.Chain
- func (manager *Manager) Close() error
- func (manager Manager) Consensus() generator.Consensus
- func (manager *Manager) DeleteAccountBlocks(blocks []*ledger.AccountBlock) error
- func (manager *Manager) DeleteSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
- func (manager *Manager) GetAllCallersFrontOnRoad(gid types.Gid, addr types.Address) ([]*ledger.AccountBlock, error)
- func (manager *Manager) GetOnRoadTotalNumByAddr(gid types.Gid, addr types.Address) (uint64, error)
- func (manager Manager) Info() map[string]interface{}
- func (manager *Manager) Init(chain chain.Chain)
- func (manager *Manager) InsertAccountBlocks(blocks []*vm_db.VmAccountBlock) error
- func (manager *Manager) InsertSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
- func (manager *Manager) IsFrontOnRoadOfCaller(gid types.Gid, orAddr, caller types.Address, hash types.Hash) (bool, error)
- func (manager Manager) Net() netReader
- func (manager *Manager) PrepareDeleteAccountBlocks(blocks []*ledger.AccountBlock) error
- func (manager *Manager) PrepareDeleteSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
- func (manager *Manager) PrepareInsertAccountBlocks(blocks []*vm_db.VmAccountBlock) error
- func (manager *Manager) PrepareInsertSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
- func (manager Manager) Producer() producer
- func (manager *Manager) Start()
- func (manager *Manager) Stop()
- type Worker
Constants ¶
const ( // RETRY represents a state which the processor can retry to handle the onroad from a particular caller // to a particular contract in the next second during a block period. RETRY inferiorState = iota // OUT represents a state which the processor won't handle the onroad from a particular caller // to a particular contract during a block period any more. OUT )
Variables ¶
var ( // POMAXPROCS is used to limit the use of number of operating system threads. POMAXPROCS = 2 // ContractTaskProcessorSize is used to limit the number of processors. ContractTaskProcessorSize = POMAXPROCS )
Functions ¶
func ExcludePairTrades ¶
func ExcludePairTrades(chain JudgeGenesis, blockList []*ledger.AccountBlock) map[types.Address][]*ledger.AccountBlock
ExcludePairTrades is to exclude the trade pairs.
Types ¶
type ContractTaskProcessor ¶
type ContractTaskProcessor struct {
// contains filtered or unexported fields
}
ContractTaskProcessor is to handle onroad and generate new contract receive block.
func NewContractTaskProcessor ¶
func NewContractTaskProcessor(worker *ContractWorker, index int) *ContractTaskProcessor
NewContractTaskProcessor creates a ContractTaskProcessor.
type ContractWorker ¶
type ContractWorker struct {
// contains filtered or unexported fields
}
ContractWorker managers the task processor, it also maintains the blacklist and queues with priority for callers.
func NewContractWorker ¶
func NewContractWorker(manager *Manager) *ContractWorker
NewContractWorker creates a ContractWorker.
func (*ContractWorker) Close ¶
func (w *ContractWorker) Close() error
Close is to stop the ContractWorker.
func (*ContractWorker) GetStakeQuota ¶
func (w *ContractWorker) GetStakeQuota(addr types.Address) uint64
GetStakeQuota returns the available quota the contract can use at current.
func (*ContractWorker) GetStakeQuotas ¶
GetStakeQuotas returns the available quota the contract can use at current in batch.
func (*ContractWorker) Start ¶
func (w *ContractWorker) Start(accEvent producerevent.AccountStartEvent)
Start is to start the ContractWorker's work, it listens to the event triggered by other module.
func (ContractWorker) Status ¶
func (w ContractWorker) Status() int
Status returns the status of a ContractWorker.
func (*ContractWorker) Stop ¶
func (w *ContractWorker) Stop()
Stop is to stop the ContractWorker and free up memory.
type JudgeGenesis ¶
JudgeGenesis is used for the method ExcludePairTrades.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements contract's onRoad processing and cache management.
func NewManager ¶
func NewManager(net netReader, pool pool, producer producer, consensus generator.Consensus, wallet *wallet.Manager) *Manager
NewManager creates a onroad Manager.
func (Manager) Chain ¶
Chain returns the instance of chain.
func (Manager) Consensus ¶
Consensus returns the implementation of Consensus which manager is dependent on.
func (*Manager) DeleteAccountBlocks ¶
func (manager *Manager) DeleteAccountBlocks(blocks []*ledger.AccountBlock) error
DeleteAccountBlocks method implements and listens to chain trigger event.
func (*Manager) DeleteSnapshotBlocks ¶
func (manager *Manager) DeleteSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
DeleteSnapshotBlocks method implements and listens to chain trigger event.
func (*Manager) GetAllCallersFrontOnRoad ¶
func (manager *Manager) GetAllCallersFrontOnRoad(gid types.Gid, addr types.Address) ([]*ledger.AccountBlock, error)
GetAllCallersFrontOnRoad method returns all callers's front OnRoad blocks, those with the lowest height, in a contract OnRoad pool.
func (*Manager) GetOnRoadTotalNumByAddr ¶
GetOnRoadTotalNumByAddr method returns the total num of the contract' OnRoad blocks.
func (Manager) Info ¶
Info returns the info of all contract.
func (*Manager) Init ¶
Init is used to load all onroad into pool cache, for super node generating new contract receive block and for verifier module verifying the sequence of contract receive.
func (*Manager) InsertAccountBlocks ¶
func (manager *Manager) InsertAccountBlocks(blocks []*vm_db.VmAccountBlock) error
InsertAccountBlocks method implements and listens to chain trigger event.
func (*Manager) InsertSnapshotBlocks ¶
func (manager *Manager) InsertSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
InsertSnapshotBlocks method implements and listens to chain trigger event.
func (*Manager) IsFrontOnRoadOfCaller ¶
func (manager *Manager) IsFrontOnRoadOfCaller(gid types.Gid, orAddr, caller types.Address, hash types.Hash) (bool, error)
IsFrontOnRoadOfCaller method judges whether is the front OnRoad of a caller in a contract OnRoad pool.
func (Manager) Net ¶
func (manager Manager) Net() netReader
Net returns the implementation of Net which manager is dependent on.
func (*Manager) PrepareDeleteAccountBlocks ¶
func (manager *Manager) PrepareDeleteAccountBlocks(blocks []*ledger.AccountBlock) error
PrepareDeleteAccountBlocks method implements and listens to chain trigger event.
func (*Manager) PrepareDeleteSnapshotBlocks ¶
func (manager *Manager) PrepareDeleteSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
PrepareDeleteSnapshotBlocks method implements and listens to chain trigger event.
func (*Manager) PrepareInsertAccountBlocks ¶
func (manager *Manager) PrepareInsertAccountBlocks(blocks []*vm_db.VmAccountBlock) error
PrepareInsertAccountBlocks method implements and listens to chain trigger event.
func (*Manager) PrepareInsertSnapshotBlocks ¶
func (manager *Manager) PrepareInsertSnapshotBlocks(chunks []*ledger.SnapshotChunk) error
PrepareInsertSnapshotBlocks method implements and listens to chain trigger event.
func (Manager) Producer ¶
func (manager Manager) Producer() producer
Producer returns the implementation of Producer which manager is dependent on.