kona_derive/stages/channel/mod.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
//! Stages pertaining to the reading and decoding of channels.
//!
//! Sitting after the [FrameQueue] stage, the [ChannelBank] and [ChannelAssembler] stages are
//! responsible for reading and decoding the [Frame]s into [Channel]s. The [ChannelReader] stage
//! is responsible for decoding the [Channel]s into [Batch]es, forwarding the [Batch]es to the
//! [BatchQueue] stage.
//!
//! [Frame]: op_alloy_protocol::Frame
//! [Channel]: op_alloy_protocol::Channel
//! [Batch]: op_alloy_protocol::Batch
//! [FrameQueue]: crate::stages::FrameQueue
//! [BatchQueue]: crate::stages::BatchQueue
use crate::types::PipelineResult;
use alloc::boxed::Box;
use async_trait::async_trait;
use op_alloy_protocol::Frame;
pub(crate) mod channel_provider;
pub use channel_provider::ChannelProvider;
pub(crate) mod channel_bank;
pub use channel_bank::ChannelBank;
pub(crate) mod channel_assembler;
pub use channel_assembler::ChannelAssembler;
pub(crate) mod channel_reader;
pub use channel_reader::{ChannelReader, ChannelReaderProvider};
/// Provides frames for the [ChannelBank] and [ChannelAssembler] stages.
#[async_trait]
pub trait NextFrameProvider {
/// Retrieves the next [Frame] from the [FrameQueue] stage.
///
/// [FrameQueue]: crate::stages::FrameQueue
async fn next_frame(&mut self) -> PipelineResult<Frame>;
}