Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTxTimestamp(min, max int64, tx transaction.Transaction) error
- func DurationToTimestamp(d time.Duration) int64
- func Inspect(c module.Chain, informal bool) map[string]interface{}
- func NewManager(chain module.Chain, nm module.NetworkManager, eem eeproxy.Manager, ...) (module.ServiceManager, error)
- func TimestampToDuration(t int64) time.Duration
- func TransactionTimestampThreshold(wc state.WorldContext, g module.TransactionGroup) int64
- type Monitor
- type Platform
- type PoolCapacityMonitor
- type QueryHandler
- type TimestampRange
- type TransactionManager
- func (m *TransactionManager) Add(tx transaction.Transaction, direct bool) error
- func (m *TransactionManager) AddAndWait(tx transaction.Transaction) (<-chan interface{}, error)
- func (m *TransactionManager) Candidate(g module.TransactionGroup, wc state.WorldContext, maxBytes, maxCount int) ([]module.Transaction, int)
- func (m *TransactionManager) FilterTransactions(g module.TransactionGroup, bloom *TxBloom, max int) []module.Transaction
- func (m *TransactionManager) GetBloomOf(g module.TransactionGroup) *TxBloom
- func (m *TransactionManager) HasTx(id []byte) bool
- func (m *TransactionManager) Logger() log.Logger
- func (m *TransactionManager) NotifyFinalized(l1 module.TransactionList, r1 module.ReceiptList, l2 module.TransactionList, ...)
- func (m *TransactionManager) OnTxDrops(drops []TxDrop)
- func (m *TransactionManager) RemoveOldTxByBlockTS(group module.TransactionGroup, bts int64)
- func (m *TransactionManager) RemoveTxs(g module.TransactionGroup, l module.TransactionList)
- func (m *TransactionManager) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
- func (m *TransactionManager) Wait(wc state.WorldContext, cb func()) bool
- func (m *TransactionManager) WaitResult(id []byte) (<-chan interface{}, error)
- type TransactionPool
- func (tp *TransactionPool) Add(tx transaction.Transaction, direct bool) error
- func (tp *TransactionPool) Candidate(wc state.WorldContext, maxBytes int, maxCount int) ([]module.Transaction, int)
- func (tp *TransactionPool) CheckTxs(wc state.WorldContext) bool
- func (tp *TransactionPool) DropOldTXs(bts int64)
- func (tp *TransactionPool) FilterTransactions(bloom *TxBloom, max int) []module.Transaction
- func (tp *TransactionPool) GetBloom() *TxBloom
- func (tp *TransactionPool) HasTx(tid []byte) bool
- func (tp *TransactionPool) RemoveList(txs module.TransactionList)
- func (tp *TransactionPool) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
- func (tp *TransactionPool) SetTxManager(txm TxWaiterManager)
- func (tp *TransactionPool) Size() int
- func (tp *TransactionPool) Used() int
- type TransactionReactor
- func (r *TransactionReactor) OnFailure(err error, pi module.ProtocolInfo, b []byte)
- func (r *TransactionReactor) OnJoin(id module.PeerID)
- func (r *TransactionReactor) OnLeave(id module.PeerID)
- func (r *TransactionReactor) OnReceive(subProtocol module.ProtocolInfo, buf []byte, peerId module.PeerID) (bool, error)
- func (r *TransactionReactor) PropagateTransaction(tx transaction.Transaction) error
- func (r *TransactionReactor) Start(wallet module.Wallet)
- func (r *TransactionReactor) Stop()
- type TransactionShare
- func (ts *TransactionShare) EnableTxRequest(yn bool)
- func (ts *TransactionShare) HandleJoin(peer module.PeerID)
- func (ts *TransactionShare) HandleLeave(peer module.PeerID)
- func (ts *TransactionShare) HandleRequestTransaction(buf []byte, peer module.PeerID) (bool, error)
- func (ts *TransactionShare) OnPoolCapacityUpdated(group module.TransactionGroup, size, used int)
- func (ts *TransactionShare) Start(handler module.ProtocolHandler, wallet module.Wallet)
- func (ts *TransactionShare) Stop()
- type TxBloom
- type TxDrop
- type TxTimestampChecker
- type TxWaiterManager
Constants ¶
View Source
const ( DuplicateTransactionError errors.Code = iota + errors.CodeService TransactionPoolOverflowError ExpiredTransactionError FutureTransactionError TransitionInterruptedError InvalidTransactionError InvalidQueryError InvalidResultError NoActiveContractError NotContractAddressError InvalidPatchDataError CommittedTransactionError )
View Source
const ( LogLevelNone = iota LogLevelMsg LogLevelDebug )
View Source
const ( ReactorName = "transaction" ReactorPriority = 4 )
View Source
const ( ConfigTXTimestampThresholdDefault = int64(5 * time.Minute / time.Microsecond) ConfigPatchTimestampThreshold = int64(1 * time.Minute / time.Microsecond) )
View Source
const ConfigTransitionResultCacheEntryCount = 10
View Source
const ConfigTransitionResultCacheEntrySize = 1024 * 1024
View Source
const (
RetryCount = 2
)
Variables ¶
View Source
var ( ErrDuplicateTransaction = errors.NewBase(DuplicateTransactionError, "DuplicateTransaction") ErrTransactionPoolOverFlow = errors.NewBase(TransactionPoolOverflowError, "TransactionPoolOverFlow") ErrExpiredTransaction = errors.NewBase(ExpiredTransactionError, "ExpiredTransaction") ErrTransitionInterrupted = errors.NewBase(TransitionInterruptedError, "TransitionInterrupted") ErrInvalidTransaction = errors.NewBase(InvalidTransactionError, "InvalidTransaction") ErrCommittedTransaction = errors.NewBase(CommittedTransactionError, "CommittedTransaction") )
Functions ¶
func CheckTxTimestamp ¶
func CheckTxTimestamp(min, max int64, tx transaction.Transaction) error
func DurationToTimestamp ¶
func NewManager ¶
func TimestampToDuration ¶
func TransactionTimestampThreshold ¶
func TransactionTimestampThreshold(wc state.WorldContext, g module.TransactionGroup) int64
Types ¶
type Platform ¶ added in v0.9.1
type Platform interface { NewContractManager(dbase db.Database, dir string, logger log.Logger) (contract.ContractManager, error) NewExtensionSnapshot(dbase db.Database, raw []byte) state.ExtensionSnapshot NewExtensionWithBuilder(builder merkle.Builder, raw []byte) state.ExtensionSnapshot OnExtensionSnapshotFinalization(ess state.ExtensionSnapshot) ToRevision(value int) module.Revision NewBaseTransaction(wc state.WorldContext) (module.Transaction, error) OnExecutionEnd(wc state.WorldContext) error Term() }
type PoolCapacityMonitor ¶
type PoolCapacityMonitor interface {
OnPoolCapacityUpdated(group module.TransactionGroup, size, used int)
}
type QueryHandler ¶
type QueryHandler struct {
// contains filtered or unexported fields
}
func NewQueryHandler ¶
func NewQueryHandler(cm contract.ContractManager, to module.Address, data []byte) (*QueryHandler, error)
type TimestampRange ¶
type TimestampRange interface {
CheckTx(tx transaction.Transaction) error
}
func NewDummyTimeStampRange ¶
func NewDummyTimeStampRange() TimestampRange
func NewTimestampRange ¶
func NewTimestampRange(bts int64, th int64) TimestampRange
func NewTxTimestampRangeFor ¶
func NewTxTimestampRangeFor(c state.WorldContext, g module.TransactionGroup) TimestampRange
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
func NewTransactionManager ¶
func NewTransactionManager(nid int, tsc *TxTimestampChecker, ptp *TransactionPool, ntp *TransactionPool, bk db.Bucket, logger log.Logger) *TransactionManager
func (*TransactionManager) Add ¶
func (m *TransactionManager) Add(tx transaction.Transaction, direct bool) error
func (*TransactionManager) AddAndWait ¶
func (m *TransactionManager) AddAndWait(tx transaction.Transaction) ( <-chan interface{}, error, )
func (*TransactionManager) Candidate ¶
func (m *TransactionManager) Candidate( g module.TransactionGroup, wc state.WorldContext, maxBytes, maxCount int, ) ([]module.Transaction, int)
func (*TransactionManager) FilterTransactions ¶
func (m *TransactionManager) FilterTransactions(g module.TransactionGroup, bloom *TxBloom, max int) []module.Transaction
func (*TransactionManager) GetBloomOf ¶
func (m *TransactionManager) GetBloomOf(g module.TransactionGroup) *TxBloom
func (*TransactionManager) HasTx ¶
func (m *TransactionManager) HasTx(id []byte) bool
func (*TransactionManager) Logger ¶
func (m *TransactionManager) Logger() log.Logger
func (*TransactionManager) NotifyFinalized ¶
func (m *TransactionManager) NotifyFinalized( l1 module.TransactionList, r1 module.ReceiptList, l2 module.TransactionList, r2 module.ReceiptList, )
func (*TransactionManager) OnTxDrops ¶
func (m *TransactionManager) OnTxDrops(drops []TxDrop)
func (*TransactionManager) RemoveOldTxByBlockTS ¶
func (m *TransactionManager) RemoveOldTxByBlockTS(group module.TransactionGroup, bts int64)
func (*TransactionManager) RemoveTxs ¶
func (m *TransactionManager) RemoveTxs( g module.TransactionGroup, l module.TransactionList, )
func (*TransactionManager) SetPoolCapacityMonitor ¶
func (m *TransactionManager) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
func (*TransactionManager) Wait ¶
func (m *TransactionManager) Wait(wc state.WorldContext, cb func()) bool
func (*TransactionManager) WaitResult ¶
func (m *TransactionManager) WaitResult(id []byte) (<-chan interface{}, error)
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
func NewTransactionPool ¶
func NewTransactionPool(group module.TransactionGroup, size int, txdb db.Bucket, m Monitor, log log.Logger) *TransactionPool
func (*TransactionPool) Add ¶
func (tp *TransactionPool) Add(tx transaction.Transaction, direct bool) error
return nil if tx is nil or tx is added to pool return ErrTransactionPoolOverFlow if pool is full
func (*TransactionPool) Candidate ¶
func (tp *TransactionPool) Candidate(wc state.WorldContext, maxBytes int, maxCount int) ( []module.Transaction, int, )
It returns all candidates for a negative integer n.
func (*TransactionPool) CheckTxs ¶
func (tp *TransactionPool) CheckTxs(wc state.WorldContext) bool
func (*TransactionPool) DropOldTXs ¶
func (tp *TransactionPool) DropOldTXs(bts int64)
func (*TransactionPool) FilterTransactions ¶
func (tp *TransactionPool) FilterTransactions(bloom *TxBloom, max int) []module.Transaction
func (*TransactionPool) GetBloom ¶
func (tp *TransactionPool) GetBloom() *TxBloom
func (*TransactionPool) HasTx ¶
func (tp *TransactionPool) HasTx(tid []byte) bool
func (*TransactionPool) RemoveList ¶
func (tp *TransactionPool) RemoveList(txs module.TransactionList)
removeList remove transactions when transactions are finalized.
func (*TransactionPool) SetPoolCapacityMonitor ¶
func (tp *TransactionPool) SetPoolCapacityMonitor(pcm PoolCapacityMonitor)
func (*TransactionPool) SetTxManager ¶
func (tp *TransactionPool) SetTxManager(txm TxWaiterManager)
func (*TransactionPool) Size ¶
func (tp *TransactionPool) Size() int
func (*TransactionPool) Used ¶
func (tp *TransactionPool) Used() int
type TransactionReactor ¶
type TransactionReactor struct {
// contains filtered or unexported fields
}
func NewTransactionReactor ¶
func NewTransactionReactor(nm module.NetworkManager, tm *TransactionManager) *TransactionReactor
func (*TransactionReactor) OnFailure ¶
func (r *TransactionReactor) OnFailure(err error, pi module.ProtocolInfo, b []byte)
func (*TransactionReactor) OnJoin ¶
func (r *TransactionReactor) OnJoin(id module.PeerID)
func (*TransactionReactor) OnLeave ¶
func (r *TransactionReactor) OnLeave(id module.PeerID)
func (*TransactionReactor) OnReceive ¶
func (r *TransactionReactor) OnReceive(subProtocol module.ProtocolInfo, buf []byte, peerId module.PeerID) (bool, error)
func (*TransactionReactor) PropagateTransaction ¶
func (r *TransactionReactor) PropagateTransaction(tx transaction.Transaction) error
func (*TransactionReactor) Start ¶
func (r *TransactionReactor) Start(wallet module.Wallet)
func (*TransactionReactor) Stop ¶
func (r *TransactionReactor) Stop()
type TransactionShare ¶
type TransactionShare struct {
// contains filtered or unexported fields
}
func NewTransactionShare ¶
func NewTransactionShare(tm *TransactionManager) *TransactionShare
func (*TransactionShare) EnableTxRequest ¶
func (ts *TransactionShare) EnableTxRequest(yn bool)
func (*TransactionShare) HandleJoin ¶
func (ts *TransactionShare) HandleJoin(peer module.PeerID)
func (*TransactionShare) HandleLeave ¶
func (ts *TransactionShare) HandleLeave(peer module.PeerID)
func (*TransactionShare) HandleRequestTransaction ¶
func (*TransactionShare) OnPoolCapacityUpdated ¶
func (ts *TransactionShare) OnPoolCapacityUpdated(group module.TransactionGroup, size, used int)
func (*TransactionShare) Start ¶
func (ts *TransactionShare) Start(handler module.ProtocolHandler, wallet module.Wallet)
func (*TransactionShare) Stop ¶
func (ts *TransactionShare) Stop()
type TxBloom ¶
func (*TxBloom) ContainsAllOf ¶
type TxTimestampChecker ¶
type TxTimestampChecker struct {
// contains filtered or unexported fields
}
func NewTimestampChecker ¶
func NewTimestampChecker() *TxTimestampChecker
func (*TxTimestampChecker) CheckWithCurrent ¶
func (c *TxTimestampChecker) CheckWithCurrent(min int64, tx transaction.Transaction) error
func (*TxTimestampChecker) SetThreshold ¶
func (c *TxTimestampChecker) SetThreshold(d time.Duration)
func (*TxTimestampChecker) Threshold ¶
func (c *TxTimestampChecker) Threshold() int64
func (*TxTimestampChecker) TransactionThreshold ¶
func (c *TxTimestampChecker) TransactionThreshold(group module.TransactionGroup) int64
type TxWaiterManager ¶
type TxWaiterManager interface {
OnTxDrops([]TxDrop)
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.