pub struct StreamHandler<N: Network> { /* private fields */ }Expand description
Streams logs to listeners as soon as each scanned block range is processed.
This handler fetches logs per listener and forwards each non-empty result immediately. It is used by scanner modes that operate as continuous streams (e.g. historic/live scanning), where incremental delivery is preferred over collecting a fixed-size window.
§Concurrency
The max_concurrent_fetches limit applies per listener, not globally. With N listeners
and a limit of M, up to N × M concurrent RPC requests may be in-flight simultaneously.
Implementations§
Source§impl<N: Network> StreamHandler<N>
impl<N: Network> StreamHandler<N>
Sourcepub fn new(
provider: RobustProvider<N>,
listeners: Vec<EventListener>,
max_concurrent_fetches: usize,
broadcast_channel_capacity: usize,
) -> Self
pub fn new( provider: RobustProvider<N>, listeners: Vec<EventListener>, max_concurrent_fetches: usize, broadcast_channel_capacity: usize, ) -> Self
Creates a StreamHandler.
§Arguments
provider- The robust provider for making RPC callslisteners- The list of event listeners to stream logs tomax_concurrent_fetches- Limits how many log-fetching RPC requests can be in-flight per listener at once.broadcast_channel_capacity- Capacity for the broadcast channel used to distribute block ranges to consumers.
Trait Implementations§
Source§impl<N: Network> BlockRangeHandler for StreamHandler<N>
impl<N: Network> BlockRangeHandler for StreamHandler<N>
Auto Trait Implementations§
impl<N> Freeze for StreamHandler<N>
impl<N> !RefUnwindSafe for StreamHandler<N>
impl<N> Send for StreamHandler<N>
impl<N> Sync for StreamHandler<N>
impl<N> Unpin for StreamHandler<N>
impl<N> UnsafeUnpin for StreamHandler<N>
impl<N> !UnwindSafe for StreamHandler<N>
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