pub struct MemoryPool<T> { /* private fields */ }Expand description
Implementation of Mempool effects using pure_stage::Effects.
It supports operations
- for the tx submission protocol
- for transaction validation
Implementations§
Source§impl<T> MemoryPool<T>
impl<T> MemoryPool<T>
pub fn new(effects: Effects<T>) -> MemoryPool<T>
Sourcepub fn external_sync<E: ExternalEffectSync + Serialize + 'static>(
&self,
effect: E,
) -> E::Response
pub fn external_sync<E: ExternalEffectSync + Serialize + 'static>( &self, effect: E, ) -> E::Response
This function runs an external effect synchronously.
Trait Implementations§
Source§impl<T: SendData + Sync> CanValidateTransactions<Transaction> for MemoryPool<T>
impl<T: SendData + Sync> CanValidateTransactions<Transaction> for MemoryPool<T>
Source§fn validate_transaction(
&self,
tx: Transaction,
) -> Result<(), TransactionValidationError>
fn validate_transaction( &self, tx: Transaction, ) -> Result<(), TransactionValidationError>
This effect uses the ledger to validate a transaction before adding it to the mempool.
Source§impl<T: Clone> Clone for MemoryPool<T>
impl<T: Clone> Clone for MemoryPool<T>
Source§fn clone(&self) -> MemoryPool<T>
fn clone(&self) -> MemoryPool<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: SendData + Sync> TxSubmissionMempool<Transaction> for MemoryPool<T>
impl<T: SendData + Sync> TxSubmissionMempool<Transaction> for MemoryPool<T>
Source§fn insert(
&self,
tx: Transaction,
tx_origin: TxOrigin,
) -> Result<(TxId, MempoolSeqNo), TxRejectReason>
fn insert( &self, tx: Transaction, tx_origin: TxOrigin, ) -> Result<(TxId, MempoolSeqNo), TxRejectReason>
This effect inserts a transaction into the mempool, specifying its origin. A TxOrigin::Local origin indicates the transaction was created on the current node, A TxOrigin::Remote(origin_peer) indicates the transaction was received from a remote peer
Source§fn get_tx(&self, tx_id: &TxId) -> Option<Transaction>
fn get_tx(&self, tx_id: &TxId) -> Option<Transaction>
This effect retrieves a transaction by its id. It returns None if the transaction is not found.
Source§fn tx_ids_since(
&self,
from_seq: MempoolSeqNo,
limit: u16,
) -> Vec<(TxId, u32, MempoolSeqNo)>
fn tx_ids_since( &self, from_seq: MempoolSeqNo, limit: u16, ) -> Vec<(TxId, u32, MempoolSeqNo)>
This effect retrieves a list of transaction ids from a given sequence number (inclusive), up to a given limit.
Source§fn wait_for_at_least(
&self,
seq_no: MempoolSeqNo,
) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>
fn wait_for_at_least( &self, seq_no: MempoolSeqNo, ) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>
This effect waits until the mempool reaches at least the given sequence number.
Source§fn get_txs_for_ids(&self, ids: &[TxId]) -> Vec<Transaction>
fn get_txs_for_ids(&self, ids: &[TxId]) -> Vec<Transaction>
This effect retrieves a list of transactions for the given ids.
Source§fn last_seq_no(&self) -> MempoolSeqNo
fn last_seq_no(&self) -> MempoolSeqNo
This effect gets the last assigned sequence number in the mempool.
Auto Trait Implementations§
impl<T> Freeze for MemoryPool<T>
impl<T> !RefUnwindSafe for MemoryPool<T>
impl<T> Send for MemoryPool<T>where
T: Send,
impl<T> Sync for MemoryPool<T>where
T: Sync,
impl<T> Unpin for MemoryPool<T>where
T: Unpin,
impl<T> UnsafeUnpin for MemoryPool<T>
impl<T> !UnwindSafe for MemoryPool<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more