pub struct BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug,
BF: L2ChainProvider + Debug,{ /* private fields */ }
Expand description
BatchStream stage in the derivation pipeline.
This stage is introduced in the Holocene hardfork. It slots in between the ChannelReader and BatchQueue stages, buffering span batches until they are validated.
Implementations§
Source§impl<P, BF> BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug,
BF: L2ChainProvider + Debug,
impl<P, BF> BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug,
BF: L2ChainProvider + Debug,
Sourcepub const fn new(prev: P, config: Arc<RollupConfig>, fetcher: BF) -> Self
pub const fn new(prev: P, config: Arc<RollupConfig>, fetcher: BF) -> Self
Create a new BatchStream stage.
Sourcepub fn is_active(&self) -> PipelineResult<bool>
pub fn is_active(&self) -> PipelineResult<bool>
Returns if the BatchStream stage is active based on the origin timestamp and holocene activation timestamp.
Sourcepub fn get_single_batch(
&mut self,
parent: L2BlockInfo,
l1_origins: &[BlockInfo],
) -> PipelineResult<SingleBatch>
pub fn get_single_batch( &mut self, parent: L2BlockInfo, l1_origins: &[BlockInfo], ) -> PipelineResult<SingleBatch>
Gets a SingleBatch from the in-memory buffer.
Sourcepub fn try_hydrate_buffer(
&mut self,
parent: L2BlockInfo,
l1_origins: &[BlockInfo],
) -> PipelineResult<()>
pub fn try_hydrate_buffer( &mut self, parent: L2BlockInfo, l1_origins: &[BlockInfo], ) -> PipelineResult<()>
Hydrates the buffer with single batches derived from the span batch, if there is one queued up.
Trait Implementations§
Source§impl<P, BF> Debug for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug + Debug,
BF: L2ChainProvider + Debug + Debug,
impl<P, BF> Debug for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug + Debug,
BF: L2ChainProvider + Debug + Debug,
Source§impl<P, BF> NextBatchProvider for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Send + Debug,
BF: L2ChainProvider + Send + Debug,
impl<P, BF> NextBatchProvider for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Send + Debug,
BF: L2ChainProvider + Send + Debug,
Source§fn flush(&mut self)
fn flush(&mut self)
Allows the stage to flush the buffer in the crate::stages::BatchStream
if an invalid single batch is found. Pre-holocene hardfork, this will be a no-op.
Source§fn span_buffer_size(&self) -> usize
fn span_buffer_size(&self) -> usize
Returns the number of SingleBatches that are currently buffered in the BatchStream
from a SpanBatch.
Source§fn next_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
parent: L2BlockInfo,
l1_origins: &'life1 [BlockInfo],
) -> Pin<Box<dyn Future<Output = PipelineResult<Batch>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn next_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
parent: L2BlockInfo,
l1_origins: &'life1 [BlockInfo],
) -> Pin<Box<dyn Future<Output = PipelineResult<Batch>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns the next Batch in the ChannelReader stage, if the stage is not complete.
This function can only be called once while the stage is in progress, and will return
None
on subsequent calls unless the stage is reset or complete. If the stage is
complete and the batch has been consumed, an PipelineError::Eof error is returned.Source§impl<P, BF> OriginAdvancer for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Send + Debug,
BF: L2ChainProvider + Send + Debug,
impl<P, BF> OriginAdvancer for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Send + Debug,
BF: L2ChainProvider + Send + Debug,
Source§fn advance_origin<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = PipelineResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn advance_origin<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = PipelineResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Advances the internal state of the lowest stage to the next l1 origin.
This method is the equivalent of the reference implementation
advance_l1_block
.Source§impl<P, BF> OriginProvider for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug,
BF: L2ChainProvider + Debug,
impl<P, BF> OriginProvider for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug,
BF: L2ChainProvider + Debug,
Source§impl<P, BF> SignalReceiver for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug + Send,
BF: L2ChainProvider + Send + Debug,
impl<P, BF> SignalReceiver for BatchStream<P, BF>where
P: BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver + Debug + Send,
BF: L2ChainProvider + Send + Debug,
Auto Trait Implementations§
impl<P, BF> Freeze for BatchStream<P, BF>
impl<P, BF> RefUnwindSafe for BatchStream<P, BF>where
P: RefUnwindSafe,
BF: RefUnwindSafe,
impl<P, BF> Send for BatchStream<P, BF>
impl<P, BF> Sync for BatchStream<P, BF>
impl<P, BF> Unpin for BatchStream<P, BF>
impl<P, BF> UnwindSafe for BatchStream<P, BF>where
P: UnwindSafe,
BF: UnwindSafe,
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
Mutably borrows from an owned value. Read more