pub enum Notification {
SwitchingToLive,
ReorgDetected {
common_ancestor: u64,
},
NoPastLogsFound,
}Expand description
Notifications emitted by the scanner to signal state changes or important events.
Variants§
SwitchingToLive
Emitted when transitioning from the latest events phase to live streaming mode in sync scanners.
ReorgDetected
When a reorg occurs, the scanner adjusts its position to re-stream events from the canonical chain state. The specific behavior depends on the scanning mode (see individual scanner mode documentation for details).
§Redundant Notifications
Due to the asynchronous nature of block scanning and log fetching, you may occasionally receive this notification even after the reorg has already been accounted for. This happens when:
BlockRangeScannervalidates and emits a block range- A reorg occurs on the chain
EventScannerfetches logs for that range, but the RPC provider returns logs from the post-reorg chain state (the provider’s view has already updated)BlockRangeScannerdetects the reorg on its next check and emitsNotification::ReorgDetectedwith a new range starting from the first reorged blockEventScannerre-fetches logs for this range, which may return duplicate logs already delivered in step 3 (the new range might also extend beyond the original range)
How to handle: This is a benign race condition. Your application should be designed to handle duplicate logs idempotently (e.g., using transaction hashes or log indices as deduplication keys). Depending on your application semantics, you may also treat this notification as a signal to roll back application state derived from blocks after the reported common ancestor.
Fields
NoPastLogsFound
Emitted during the latest events phase when no matching logs are found in the scanned range.
Trait Implementations§
Source§impl Clone for Notification
impl Clone for Notification
Source§fn clone(&self) -> Notification
fn clone(&self) -> Notification
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Notification
impl Debug for Notification
Source§impl<T: Clone> From<Notification> for ScannerMessage<T>
impl<T: Clone> From<Notification> for ScannerMessage<T>
Source§fn from(value: Notification) -> Self
fn from(value: Notification) -> Self
Source§impl<T: Clone> PartialEq<Notification> for ScannerMessage<T>
impl<T: Clone> PartialEq<Notification> for ScannerMessage<T>
Source§impl PartialEq for Notification
impl PartialEq for Notification
impl Copy for Notification
impl StructuralPartialEq for Notification
Auto Trait Implementations§
impl Freeze for Notification
impl RefUnwindSafe for Notification
impl Send for Notification
impl Sync for Notification
impl Unpin for Notification
impl UnsafeUnpin for Notification
impl UnwindSafe for Notification
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§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