Struct sc_transaction_graph::base_pool::BasePool[][src]

pub struct BasePool<Hash: Hash + Eq, Ex> { /* fields omitted */ }

Transaction pool.

Builds a dependency graph for all transactions in the pool and returns the ones that are currently ready to be executed.

General note: If function returns some transactions it usually means that importing them as-is for the second time will fail or produce unwanted results. Most likely it is required to revalidate them and recompute set of required tags.

Implementations

impl<Hash: Hash + Member + Serialize, Ex: Debug> BasePool<Hash, Ex>[src]

pub fn new(reject_future_transactions: bool) -> Self[src]

Create new pool given reject_future_transactions flag.

pub fn is_imported(&self, tx_hash: &Hash) -> bool[src]

Returns if the transaction for the given hash is already imported.

pub fn import(
    &mut self,
    tx: Transaction<Hash, Ex>
) -> Result<Imported<Hash, Ex>>
[src]

Imports transaction to the pool.

The pool consists of two parts: Future and Ready. The former contains transactions that require some tags that are not yet provided by other transactions in the pool. The latter contains transactions that have all the requirements satisfied and are ready to be included in the block.

pub fn ready(&self) -> impl Iterator<Item = Arc<Transaction<Hash, Ex>>>[src]

Returns an iterator over ready transactions in the pool.

pub fn futures(&self) -> impl Iterator<Item = &Transaction<Hash, Ex>>[src]

Returns an iterator over future transactions in the pool.

pub fn by_hashes(
    &self,
    hashes: &[Hash]
) -> Vec<Option<Arc<Transaction<Hash, Ex>>>>
[src]

Returns pool transactions given list of hashes.

Includes both ready and future pool. For every hash in the hashes iterator an Option is produced (so the resulting Vec always have the same length).

pub fn ready_by_hash(&self, hash: &Hash) -> Option<Arc<Transaction<Hash, Ex>>>[src]

Returns pool transaction by hash.

pub fn enforce_limits(
    &mut self,
    ready: &Limit,
    future: &Limit
) -> Vec<Arc<Transaction<Hash, Ex>>>
[src]

Makes sure that the transactions in the queues stay within provided limits.

Removes and returns worst transactions from the queues and all transactions that depend on them. Technically the worst transaction should be evaluated by computing the entire pending set. We use a simplified approach to remove the transaction that occupies the pool for the longest time.

pub fn remove_subtree(
    &mut self,
    hashes: &[Hash]
) -> Vec<Arc<Transaction<Hash, Ex>>>
[src]

Removes all transactions represented by the hashes and all other transactions that depend on them.

Returns a list of actually removed transactions. NOTE some transactions might still be valid, but were just removed because they were part of a chain, you may attempt to re-import them later. NOTE If you want to remove ready transactions that were already used and you don’t want them to be stored in the pool use prune_tags method.

pub fn clear_future(&mut self) -> Vec<Arc<Transaction<Hash, Ex>>>[src]

Removes and returns all transactions from the future queue.

pub fn prune_tags(
    &mut self,
    tags: impl IntoIterator<Item = Tag>
) -> PruneStatus<Hash, Ex>
[src]

Prunes transactions that provide given list of tags.

This will cause all transactions that provide these tags to be removed from the pool, but unlike remove_subtree, dependent transactions are not touched. Additional transactions from future queue might be promoted to ready if you satisfy tags that the pool didn’t previously know about.

pub fn status(&self) -> PoolStatus[src]

Get pool status.

Trait Implementations

impl<Hash: Debug + Hash + Eq, Ex: Debug> Debug for BasePool<Hash, Ex>[src]

impl<Hash: Hash + Member + Serialize, Ex: Debug> Default for BasePool<Hash, Ex>[src]

impl<Hash: Hash + Eq, Ex> MallocSizeOf for BasePool<Hash, Ex> where
    Hash: MallocSizeOf,
    Ex: MallocSizeOf
[src]

Auto Trait Implementations

impl<Hash, Ex> !RefUnwindSafe for BasePool<Hash, Ex>

impl<Hash, Ex> Send for BasePool<Hash, Ex> where
    Ex: Send + Sync,
    Hash: Send + Sync

impl<Hash, Ex> Sync for BasePool<Hash, Ex> where
    Ex: Send + Sync,
    Hash: Send + Sync

impl<Hash, Ex> Unpin for BasePool<Hash, Ex> where
    Hash: Unpin

impl<Hash, Ex> !UnwindSafe for BasePool<Hash, Ex>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MallocSizeOfExt for T where
    T: MallocSizeOf
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> MaybeMallocSizeOf for T where
    T: MallocSizeOf
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SaturatedConversion for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]