pub struct Channel {
id: ChannelId,
open_block: BlockInfo,
estimated_size: usize,
closed: bool,
highest_frame_number: u16,
last_frame_number: u16,
inputs: HashMap<u16, Frame>,
highest_l1_inclusion_block: BlockInfo,
}
Expand description
A Channel is a set of batches that are split into at least one, but possibly multiple frames.
Frames are allowed to be ingested out of order.
Each frame is ingested one by one. Once a frame with closed
is added to the channel, the
channel may mark itself as ready for reading once all intervening frames have been added
Fields§
§id: ChannelId
The unique identifier for this channel
open_block: BlockInfo
The block that the channel is currently open at
estimated_size: usize
Estimated memory size, used to drop the channel if we have too much data
closed: bool
True if the last frame has been buffered
highest_frame_number: u16
The highest frame number that has been ingested
last_frame_number: u16
The frame number of the frame where is_last
is true
No other frame number may be higher than this
inputs: HashMap<u16, Frame>
Store a map of frame number to frame for constant time ordering
highest_l1_inclusion_block: BlockInfo
The highest L1 inclusion block that a frame was included in
Implementations§
source§impl Channel
impl Channel
sourcepub fn add_frame(
&mut self,
frame: Frame,
l1_inclusion_block: BlockInfo,
) -> Result<(), ChannelError>
pub fn add_frame( &mut self, frame: Frame, l1_inclusion_block: BlockInfo, ) -> Result<(), ChannelError>
sourcepub const fn open_block_number(&self) -> u64
pub const fn open_block_number(&self) -> u64
Returns the block number of the L1 block that contained the first Frame in this channel.
sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
Returns the estimated size of the channel including Frame overhead.
sourcepub fn frame_data(&self) -> Option<Bytes>
pub fn frame_data(&self) -> Option<Bytes>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnwindSafe for Channel
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 240 bytes