Struct sc_transaction_graph::base_pool::BasePool [−][src]
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]
&mut self,
tx: Transaction<Hash, Ex>
) -> Result<Imported<Hash, Ex>>
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]
&self,
hashes: &[Hash]
) -> Vec<Option<Arc<Transaction<Hash, Ex>>>>
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]
&mut self,
ready: &Limit,
future: &Limit
) -> Vec<Arc<Transaction<Hash, Ex>>>
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]
&mut self,
hashes: &[Hash]
) -> Vec<Arc<Transaction<Hash, Ex>>>
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]
&mut self,
tags: impl IntoIterator<Item = Tag>
) -> PruneStatus<Hash, Ex>
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]
Hash: MallocSizeOf,
Ex: MallocSizeOf,
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
pub fn constant_size() -> Option<usize>
[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,
Ex: Send + Sync,
Hash: Send + Sync,
impl<Hash, Ex> Sync for BasePool<Hash, Ex> where
Ex: Send + Sync,
Hash: Send + Sync,
Ex: Send + Sync,
Hash: Send + Sync,
impl<Hash, Ex> Unpin for BasePool<Hash, Ex> where
Hash: Unpin,
Hash: Unpin,
impl<Hash, Ex> !UnwindSafe for BasePool<Hash, Ex>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
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]
T: MallocSizeOf,
pub fn malloc_size_of(&self) -> usize
[src]
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeMallocSizeOf for T where
T: MallocSizeOf,
[src]
T: MallocSizeOf,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
[src]
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
[src]
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
[src]
Self: UniqueSaturatedInto<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
[src]
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,