Skip to content

Commit 6d7c6f6

Browse files
authored
docs: minor reorg-related updates + fix doc link + dashes to stars (#235)
1 parent c3c3ce4 commit 6d7c6f6

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

src/event_scanner/scanner/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub enum ConsumerMode {
3535
///
3636
/// Log consumers are tightly coupled with the `ConsumerMode` because the mode dictates their
3737
/// entire lifecycle and behavior:
38-
/// - `Stream` mode: consumers forward logs immediately as they arrive
39-
/// - `CollectLatest` mode: consumers accumulate logs and send them only at the end
38+
/// * `Stream` mode: consumers forward logs immediately as they arrive
39+
/// * `CollectLatest` mode: consumers accumulate logs and send them only at the end
4040
///
4141
/// This tight coupling means consumers cannot be reused across different modes. For example,
4242
/// the "sync from latest" scanning strategy needs to run two modes sequentially (first

src/event_scanner/scanner/mod.rs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@ impl EventScannerBuilder<Unspecified> {
130130
///
131131
/// # Key behaviors
132132
///
133-
/// - **Continuous streaming**: Events are delivered in multiple messages as they are fetched
134-
/// - **Chronological order**: Events are always delivered oldest to newest
135-
/// - **Default range**: By default, scans from `Earliest` to `Latest` block
136-
/// - **Batch control**: Use `.max_block_range(n)` to control how many blocks are queried per
133+
/// * **Continuous streaming**: Events are delivered in multiple messages as they are fetched
134+
/// * **Chronological order**: Events are always delivered oldest to newest
135+
/// * **Default range**: By default, scans from `Earliest` to `Latest` block
136+
/// * **Batch control**: Use `.max_block_range(n)` to control how many blocks are queried per
137137
/// RPC call
138-
/// - **Completion**: The scanner completes when the entire range has been processed
138+
/// * **Reorg handling**: Performs reorg checks when streaming events from non-finalized blocks;
139+
/// if a reorg is detected, streams events from the reorged blocks
140+
/// * **Completion**: The scanner completes when the entire range has been processed.
139141
#[must_use]
140142
pub fn historic() -> EventScannerBuilder<Historic> {
141143
EventScannerBuilder::default()
@@ -190,11 +192,11 @@ impl EventScannerBuilder<Unspecified> {
190192
///
191193
/// # Key behaviors
192194
///
193-
/// - **Real-time streaming**: Events are delivered as new blocks are confirmed
194-
/// - **Reorg protection**: Waits for configured confirmations before emitting events
195-
/// - **Continuous operation**: Runs indefinitely until the scanner is dropped or encounters an
195+
/// * **Real-time streaming**: Events are delivered as new blocks are confirmed
196+
/// * **Reorg protection**: Waits for configured confirmations before emitting events
197+
/// * **Continuous operation**: Runs indefinitely until the scanner is dropped or encounters an
196198
/// error
197-
/// - **Default confirmations**: By default, waits for 12 block confirmations
199+
/// * **Default confirmations**: By default, waits for 12 block confirmations
198200
///
199201
/// # Reorg behavior
200202
///
@@ -222,8 +224,8 @@ impl EventScannerBuilder<Unspecified> {
222224
/// EventScannerBuilder::sync().from_latest(10);
223225
/// ```
224226
///
225-
/// See [`from_block`](EventScannerBuilder::from_block) and
226-
/// [`from_latest`](EventScannerBuilder::from_latest) for details on each mode.
227+
/// See [`from_block`](crate::EventScannerBuilder#method.from_block-2) and
228+
/// [`from_latest`](crate::EventScannerBuilder#method.from_latest) for details on each mode.
227229
#[must_use]
228230
pub fn sync() -> EventScannerBuilder<Synchronize> {
229231
EventScannerBuilder::default()
@@ -290,20 +292,20 @@ impl EventScannerBuilder<Unspecified> {
290292
///
291293
/// # Key behaviors
292294
///
293-
/// - **Single delivery**: Each registered stream receives at most `count` logs in a single
295+
/// * **Single delivery**: Each registered stream receives at most `count` logs in a single
294296
/// message, chronologically ordered
295-
/// - **One-shot operation**: The scanner completes after delivering messages; it does not
297+
/// * **One-shot operation**: The scanner completes after delivering messages; it does not
296298
/// continue streaming
297-
/// - **Flexible count**: If fewer than `count` events exist in the range, returns all available
299+
/// * **Flexible count**: If fewer than `count` events exist in the range, returns all available
298300
/// events
299-
/// - **Default range**: By default, scans from `Earliest` to `Latest` block
300-
/// - **Reorg handling**: Periodically checks the tip to detect reorgs during the scan
301+
/// * **Default range**: By default, scans from `Earliest` to `Latest` block
302+
/// * **Reorg handling**: Periodically checks the tip to detect reorgs during the scan
301303
///
302304
/// # Notifications
303305
///
304306
/// The scanner emits the following notification before delivering log data:
305307
///
306-
/// - **[`Notification::NoPastLogsFound`][no_logs]**: Emitted when no matching logs are found in
308+
/// * **[`Notification::NoPastLogsFound`][no_logs]**: Emitted when no matching logs are found in
307309
/// the scanned range.
308310
///
309311
/// # Arguments
@@ -392,10 +394,10 @@ impl<M> EventScannerBuilder<M> {
392394
/// # Example
393395
///
394396
/// If scanning events from blocks 1000–1099 (100 blocks total) with `max_block_range(30)`:
395-
/// - Batch 1: blocks 1000–1029 (30 blocks)
396-
/// - Batch 2: blocks 1030–1059 (30 blocks)
397-
/// - Batch 3: blocks 1060–1089 (30 blocks)
398-
/// - Batch 4: blocks 1090–1099 (10 blocks)
397+
/// * Batch 1: blocks 1000–1029 (30 blocks)
398+
/// * Batch 2: blocks 1030–1059 (30 blocks)
399+
/// * Batch 3: blocks 1060–1089 (30 blocks)
400+
/// * Batch 4: blocks 1090–1099 (10 blocks)
399401
#[must_use]
400402
pub fn max_block_range(mut self, max_block_range: u64) -> Self {
401403
self.block_range_scanner.max_block_range = max_block_range;

src/event_scanner/scanner/sync/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,20 @@ impl EventScannerBuilder<Synchronize> {
7171
///
7272
/// # Key behaviors
7373
///
74-
/// - **No duplicates**: Events are not delivered twice across the phase transition
75-
/// - **Flexible count**: If fewer than `count` events exist, returns all available events
76-
/// - **Reorg handling**: Both phases handle reorgs appropriately:
74+
/// * **No duplicates**: Events are not delivered twice across the phase transition
75+
/// * **Flexible count**: If fewer than `count` events exist, returns all available events
76+
/// * **Reorg handling**: Both phases handle reorgs appropriately:
7777
/// - Latest events phase: resets and rescans on reorg detection
7878
/// - Live phase: resets stream to the first post-reorg block that satisfies the configured
7979
/// block confirmations
80-
/// - **Continuous operation**: Live phase continues indefinitely until the scanner is dropped
80+
/// * **Continuous operation**: Live phase continues indefinitely until the scanner is dropped
8181
///
8282
/// # Notifications
8383
///
8484
/// During the **latest events phase**, the scanner can emit the following notification
8585
/// before transitioning to live mode:
8686
///
87-
/// - **[`Notification::NoPastLogsFound`][no_logs]**: Emitted when no matching logs are found in
87+
/// * **[`Notification::NoPastLogsFound`][no_logs]**: Emitted when no matching logs are found in
8888
/// the scanned range
8989
///
9090
/// After the latest events phase completes, [`Notification::SwitchingToLive`][switch_to_live]
@@ -97,15 +97,15 @@ impl EventScannerBuilder<Synchronize> {
9797
///
9898
/// # Important notes
9999
///
100-
/// - The live phase continues indefinitely until the scanner is dropped or encounters an error
100+
/// * The live phase continues indefinitely until the scanner is dropped or encounters an error
101101
///
102102
/// # Detailed reorg behavior
103103
///
104-
/// - **Latest events phase**: Restart the scanner. On detecting a reorg, emits
104+
/// * **Latest events phase**: Restart the scanner. On detecting a reorg, emits
105105
/// [`Notification::ReorgDetected`][reorg], resets the rewind start to the new tip, and
106106
/// continues until collectors accumulate `count` logs. Final delivery to listeners preserves
107107
/// chronological order.
108-
/// - **Live streaming phase**: Starts from `latest_block + 1` and respects the configured block
108+
/// * **Live streaming phase**: Starts from `latest_block + 1` and respects the configured block
109109
/// confirmations. On reorg, emits [`Notification::ReorgDetected`][reorg], adjusts the next
110110
/// confirmed window (possibly re-emitting confirmed portions), and continues streaming.
111111
///
@@ -203,7 +203,7 @@ impl EventScannerBuilder<Synchronize> {
203203
/// * **Continuous operation**: Live phase continues indefinitely until the scanner is dropped
204204
/// * **Reorg detection**: When a reorg is detected, [`Notification::ReorgDetected`][reorg] is
205205
/// emitted, the next confirmed window is adjusted to stream the reorged blocks, and continues
206-
/// streaming.
206+
/// streaming. While syncing, reorg checks are only performed for non-finalized blocks.
207207
///
208208
/// # Arguments
209209
///

0 commit comments

Comments
 (0)