Struct transaction_pool::Pool [−][src]
pub struct Pool<T: VerifiedTransaction, S: Scoring<T>, L = NoopListener> { /* fields omitted */ }
A transaction pool.
Methods
impl<T: VerifiedTransaction, S: Scoring<T> + Default> Pool<T, S>[src]
impl<T: VerifiedTransaction, S: Scoring<T> + Default> Pool<T, S>pub fn with_options(options: Options) -> Self[src]
pub fn with_options(options: Options) -> SelfCreates a new Pool with given options
and default Scoring and Listener.
impl<T: VerifiedTransaction, S: Scoring<T>> Pool<T, S>[src]
impl<T: VerifiedTransaction, S: Scoring<T>> Pool<T, S>pub fn with_scoring(scoring: S, options: Options) -> Self[src]
pub fn with_scoring(scoring: S, options: Options) -> SelfCreates a new Pool with given Scoring and options.
impl<T, S, L> Pool<T, S, L> where
T: VerifiedTransaction,
S: Scoring<T>,
L: Listener<T>, [src]
impl<T, S, L> Pool<T, S, L> where
T: VerifiedTransaction,
S: Scoring<T>,
L: Listener<T>, pub fn new(listener: L, scoring: S, options: Options) -> Self[src]
pub fn new(listener: L, scoring: S, options: Options) -> SelfCreates new Pool with given Scoring, Listener and options.
pub fn import(&mut self, transaction: T) -> Result<Arc<T>, Error>[src]
pub fn import(&mut self, transaction: T) -> Result<Arc<T>, Error>Attempts to import new transaction to the pool, returns a Arc<T> or an Error.
NOTE: Since Readyness is separate from the pool it's possible to import stalled transactions.
It's the caller responsibility to make sure that's not the case.
NOTE: The transaction may push out some other transactions from the pool
either because of limits (see Options) or because Scoring decides that the transaction
replaces an existing transaction from that sender.
If any limit is reached the transaction with the lowest Score is evicted to make room.
The Listener will be informed on any drops or rejections.
pub fn clear(&mut self)[src]
pub fn clear(&mut self)Clears pool from all transactions. This causes a listener notification that all transactions were dropped. NOTE: the drop-notification order will be arbitrary.
pub fn remove(&mut self, hash: &T::Hash, is_invalid: bool) -> Option<Arc<T>>[src]
pub fn remove(&mut self, hash: &T::Hash, is_invalid: bool) -> Option<Arc<T>>Removes single transaction from the pool.
Depending on the is_invalid flag the listener
will either get a cancelled or invalid notification.
pub fn cull<R: Ready<T>>(
&mut self,
senders: Option<&[T::Sender]>,
ready: R
) -> usize[src]
pub fn cull<R: Ready<T>>(
&mut self,
senders: Option<&[T::Sender]>,
ready: R
) -> usizeRemoves all stalled transactions from given sender list (or from all senders).
pub fn find(&self, hash: &T::Hash) -> Option<Arc<T>>[src]
pub fn find(&self, hash: &T::Hash) -> Option<Arc<T>>Returns a transaction if it's part of the pool or None otherwise.
pub fn worst_transaction(&self) -> Option<Arc<T>>[src]
pub fn worst_transaction(&self) -> Option<Arc<T>>Returns worst transaction in the queue (if any).
pub fn is_full(&self) -> bool[src]
pub fn is_full(&self) -> boolReturns true if the pool is at it's capacity.
pub fn senders(
&self
) -> impl Iterator<Item = &T::Sender>[src]
pub fn senders(
&self
) -> impl Iterator<Item = &T::Sender>Returns senders ordered by priority of their transactions.
ⓘImportant traits for PendingIterator<'a, T, R, S, L>pub fn pending<R: Ready<T>>(&self, ready: R) -> PendingIterator<T, R, S, L>[src]
pub fn pending<R: Ready<T>>(&self, ready: R) -> PendingIterator<T, R, S, L>Returns an iterator of pending (ready) transactions.
ⓘImportant traits for PendingIterator<'a, T, R, S, L>pub fn pending_from_sender<R: Ready<T>>(
&self,
ready: R,
sender: &T::Sender
) -> PendingIterator<T, R, S, L>[src]
pub fn pending_from_sender<R: Ready<T>>(
&self,
ready: R,
sender: &T::Sender
) -> PendingIterator<T, R, S, L>Returns pending (ready) transactions from given sender.
pub fn unordered_pending<R: Ready<T>>(
&self,
ready: R
) -> UnorderedIterator<T, R, S>[src]
pub fn unordered_pending<R: Ready<T>>(
&self,
ready: R
) -> UnorderedIterator<T, R, S>Returns unprioritized list of ready transactions.
pub fn update_scores(&mut self, sender: &T::Sender, event: S::Event)[src]
pub fn update_scores(&mut self, sender: &T::Sender, event: S::Event)Update score of transactions of a particular sender.
pub fn status<R: Ready<T>>(&self, ready: R) -> Status[src]
pub fn status<R: Ready<T>>(&self, ready: R) -> StatusComputes the full status of the pool (including readiness).
pub fn light_status(&self) -> LightStatus[src]
pub fn light_status(&self) -> LightStatusReturns light status of the pool.
pub fn options(&self) -> Options[src]
pub fn options(&self) -> OptionsReturns current pool options.
ⓘImportant traits for &'a mut Rpub fn listener(&self) -> &L[src]
pub fn listener(&self) -> &LBorrows listener instance.
ⓘImportant traits for &'a mut Rpub fn scoring(&self) -> &S[src]
pub fn scoring(&self) -> &SBorrows scoring instance.
ⓘImportant traits for &'a mut Rpub fn listener_mut(&mut self) -> &mut L[src]
pub fn listener_mut(&mut self) -> &mut LBorrows listener mutably.
Trait Implementations
impl<T: Debug + VerifiedTransaction, S: Debug + Scoring<T>, L: Debug> Debug for Pool<T, S, L> where
T::Sender: Debug,
T::Hash: Debug,
S::Score: Debug, [src]
impl<T: Debug + VerifiedTransaction, S: Debug + Scoring<T>, L: Debug> Debug for Pool<T, S, L> where
T::Sender: Debug,
T::Hash: Debug,
S::Score: Debug, fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: VerifiedTransaction, S: Scoring<T> + Default> Default for Pool<T, S>[src]
impl<T: VerifiedTransaction, S: Scoring<T> + Default> Default for Pool<T, S>Auto Trait Implementations
impl<T, S, L> Send for Pool<T, S, L> where
L: Send,
S: Send,
T: Send + Sync,
<T as VerifiedTransaction>::Hash: Send,
<S as Scoring<T>>::Score: Send,
<T as VerifiedTransaction>::Sender: Send,
impl<T, S, L> Send for Pool<T, S, L> where
L: Send,
S: Send,
T: Send + Sync,
<T as VerifiedTransaction>::Hash: Send,
<S as Scoring<T>>::Score: Send,
<T as VerifiedTransaction>::Sender: Send, impl<T, S, L> Sync for Pool<T, S, L> where
L: Sync,
S: Sync,
T: Send + Sync,
<T as VerifiedTransaction>::Hash: Sync,
<S as Scoring<T>>::Score: Sync,
<T as VerifiedTransaction>::Sender: Sync,
impl<T, S, L> Sync for Pool<T, S, L> where
L: Sync,
S: Sync,
T: Send + Sync,
<T as VerifiedTransaction>::Hash: Sync,
<S as Scoring<T>>::Score: Sync,
<T as VerifiedTransaction>::Sender: Sync,