pub struct LatestEventsHandler<N: Network> { /* private fields */ }Expand description
Collects the latest count logs per listener before streaming them.
This handler performs a reverse scan (newest-to-oldest) while buffering logs locally. Once
count matching logs are collected (or the scan finishes), it emits the collected logs in
chronological order (oldest-to-newest) and stops.
During reorg recovery it prepends newly fetched logs so that the newest-first buffer remains correctly ordered.
§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> LatestEventsHandler<N>
impl<N: Network> LatestEventsHandler<N>
Sourcepub fn new(
provider: RobustProvider<N>,
listeners: Vec<EventListener>,
max_concurrent_fetches: usize,
count: usize,
broadcast_channel_capacity: usize,
) -> Self
pub fn new( provider: RobustProvider<N>, listeners: Vec<EventListener>, max_concurrent_fetches: usize, count: usize, broadcast_channel_capacity: usize, ) -> Self
Creates a LatestEventsHandler.
§Arguments
provider- The robust provider to use for fetching logslisteners- The list of event listeners to collect logs formax_concurrent_fetches- Maximum number of concurrent log-fetching RPC requests per listenercount- Maximum number of logs to collect per listener before streamingbroadcast_channel_capacity- Capacity of the broadcast channel for forwarding results
Trait Implementations§
Source§impl<N: Network> BlockRangeHandler for LatestEventsHandler<N>
impl<N: Network> BlockRangeHandler for LatestEventsHandler<N>
Auto Trait Implementations§
impl<N> Freeze for LatestEventsHandler<N>
impl<N> !RefUnwindSafe for LatestEventsHandler<N>
impl<N> Send for LatestEventsHandler<N>
impl<N> Sync for LatestEventsHandler<N>
impl<N> Unpin for LatestEventsHandler<N>
impl<N> UnsafeUnpin for LatestEventsHandler<N>
impl<N> !UnwindSafe for LatestEventsHandler<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