pub struct ChannelBank<P>{ /* private fields */ }
Expand description
ChannelBank is a stateful stage that does the following:
- Unmarshalls frames from L1 transaction data
- Applies those frames to a channel
- Attempts to read from the channel when it is ready
- Prunes channels (not frames) when the channel bank is too large.
Note: we prune before we ingest data.
As we switch between ingesting data & reading, the prune step occurs at an odd point
Specifically, the channel bank is not allowed to become too large between successive calls
to IngestData
. This means that we can do an ingest and then do a read while becoming too
large. ChannelBank buffers channel frames, and emits full channel data
Implementations§
Source§impl<P> ChannelBank<P>
impl<P> ChannelBank<P>
Sourcepub fn new(cfg: Arc<RollupConfig>, prev: P) -> ChannelBank<P>
pub fn new(cfg: Arc<RollupConfig>, prev: P) -> ChannelBank<P>
Create a new ChannelBank stage.
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns the size of the channel bank by accumulating over all channels.
Sourcepub fn prune(&mut self) -> Result<(), PipelineErrorKind>
pub fn prune(&mut self) -> Result<(), PipelineErrorKind>
Prunes the Channel bank, until it is below the max channel bank size. Prunes from the high-priority channel since it failed to be read.
Sourcepub fn ingest_frame(&mut self, frame: Frame) -> Result<(), PipelineErrorKind>
pub fn ingest_frame(&mut self, frame: Frame) -> Result<(), PipelineErrorKind>
Adds new L1 data to the channel bank. Should only be called after all data has been read.
Trait Implementations§
Source§impl<P> ChannelReaderProvider for ChannelBank<P>
impl<P> ChannelReaderProvider for ChannelBank<P>
Source§fn next_data<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, PipelineErrorKind>> + Send + 'async_trait>>where
'life0: 'async_trait,
ChannelBank<P>: 'async_trait,
fn next_data<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, PipelineErrorKind>> + Send + 'async_trait>>where
'life0: 'async_trait,
ChannelBank<P>: 'async_trait,
Source§impl<P> Debug for ChannelBank<P>
impl<P> Debug for ChannelBank<P>
Source§impl<P> OriginAdvancer for ChannelBank<P>
impl<P> OriginAdvancer for ChannelBank<P>
Source§fn advance_origin<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), PipelineErrorKind>> + Send + 'async_trait>>where
'life0: 'async_trait,
ChannelBank<P>: '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,
ChannelBank<P>: 'async_trait,
advance_l1_block
.Source§impl<P> OriginProvider for ChannelBank<P>
impl<P> OriginProvider for ChannelBank<P>
Source§impl<P> SignalReceiver for ChannelBank<P>
impl<P> SignalReceiver for ChannelBank<P>
Auto Trait Implementations§
impl<P> Freeze for ChannelBank<P>where
P: Freeze,
impl<P> RefUnwindSafe for ChannelBank<P>where
P: RefUnwindSafe,
impl<P> Send for ChannelBank<P>where
P: Send,
impl<P> Sync for ChannelBank<P>where
P: Sync,
impl<P> Unpin for ChannelBank<P>where
P: Unpin,
impl<P> UnwindSafe for ChannelBank<P>where
P: 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
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