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,
) -> BatchStream<P, BF>
pub const fn new( prev: P, config: Arc<RollupConfig>, fetcher: BF, ) -> BatchStream<P, BF>
Create a new BatchStream stage.
Sourcepub fn is_active(&self) -> Result<bool, PipelineErrorKind>
pub fn is_active(&self) -> Result<bool, PipelineErrorKind>
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],
) -> Result<SingleBatch, PipelineErrorKind>
pub fn get_single_batch( &mut self, parent: L2BlockInfo, l1_origins: &[BlockInfo], ) -> Result<SingleBatch, PipelineErrorKind>
Gets a SingleBatch from the in-memory buffer.
Sourcepub fn try_hydrate_buffer(
&mut self,
parent: L2BlockInfo,
l1_origins: &[BlockInfo],
) -> Result<(), PipelineErrorKind>
pub fn try_hydrate_buffer( &mut self, parent: L2BlockInfo, l1_origins: &[BlockInfo], ) -> Result<(), PipelineErrorKind>
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: Debug + BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver,
BF: Debug + L2ChainProvider,
impl<P, BF> Debug for BatchStream<P, BF>where
P: Debug + BatchStreamProvider + OriginAdvancer + OriginProvider + SignalReceiver,
BF: Debug + L2ChainProvider,
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 = Result<Batch, PipelineErrorKind>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BatchStream<P, BF>: 'async_trait,
fn next_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
parent: L2BlockInfo,
l1_origins: &'life1 [BlockInfo],
) -> Pin<Box<dyn Future<Output = Result<Batch, PipelineErrorKind>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
BatchStream<P, BF>: '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 = Result<(), PipelineErrorKind>> + Send + 'async_trait>>where
'life0: 'async_trait,
BatchStream<P, BF>: 'async_trait,
fn advance_origin<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineErrorKind>> + Send + 'async_trait>>where
'life0: 'async_trait,
BatchStream<P, BF>: '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
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>
Converts
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>
Converts
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