Skip to main content

TransactionQueue

Trait TransactionQueue 

Source
pub trait TransactionQueue<T>:
    Debug
    + Default
    + Extend<T>
    + Sync
    + Send {
    // Required methods
    fn is_empty(&self) -> bool;
    fn choose<R: Rng>(
        &mut self,
        rng: &mut R,
        amount: usize,
        batch_size: usize,
    ) -> Vec<T>;
    fn remove_multiple<'a, I>(&mut self, txs: I)
       where I: IntoIterator<Item = &'a T>,
             T: 'a + Contribution;
}
Expand description

An interface to the transaction queue. A transaction queue is a structural part of QueueingHoneyBadger that manages enqueueing of transactions for a future batch and dequeueing of transactions to become part of a current batch.

Required Methods§

Source

fn is_empty(&self) -> bool

Checks whether the queue is empty.

Source

fn choose<R: Rng>( &mut self, rng: &mut R, amount: usize, batch_size: usize, ) -> Vec<T>

Returns a new set of amount transactions, randomly chosen from the first batch_size. No transactions are removed from the queue.

Source

fn remove_multiple<'a, I>(&mut self, txs: I)
where I: IntoIterator<Item = &'a T>, T: 'a + Contribution,

Removes the given transactions from the queue.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> TransactionQueue<T> for Vec<T>
where T: Clone + Debug + Sync + Send,

Source§

fn is_empty(&self) -> bool

Source§

fn remove_multiple<'a, I>(&mut self, txs: I)
where I: IntoIterator<Item = &'a T>, T: 'a + Contribution,

Source§

fn choose<R: Rng>( &mut self, rng: &mut R, amount: usize, batch_size: usize, ) -> Vec<T>

Implementors§