@@ -21,37 +21,42 @@ mod latest;
2121mod live;
2222mod sync;
2323
24- /// Maximum number of concurrent fetches for block ranges in the current scanner mode.
24+ /// Default number of maximum concurrent fetches for each scanner mode.
2525pub const DEFAULT_MAX_CONCURRENT_FETCHES : usize = 24 ;
2626
2727#[ derive( Default ) ]
2828pub struct Unspecified ;
2929pub struct Historic {
3030 pub ( crate ) from_block : BlockId ,
3131 pub ( crate ) to_block : BlockId ,
32+ /// Controls how many log-fetching RPC requests can run in parallel during the scan.
3233 pub ( crate ) max_concurrent_fetches : usize ,
3334}
3435pub struct Live {
3536 pub ( crate ) block_confirmations : u64 ,
37+ /// Controls how many log-fetching RPC requests can run in parallel during the scan.
3638 pub ( crate ) max_concurrent_fetches : usize ,
3739}
3840pub struct LatestEvents {
3941 pub ( crate ) count : usize ,
4042 pub ( crate ) from_block : BlockId ,
4143 pub ( crate ) to_block : BlockId ,
4244 pub ( crate ) block_confirmations : u64 ,
45+ /// Controls how many log-fetching RPC requests can run in parallel during the scan.
4346 pub ( crate ) max_concurrent_fetches : usize ,
4447}
4548#[ derive( Default ) ]
4649pub struct Synchronize ;
4750pub struct SyncFromLatestEvents {
4851 pub ( crate ) count : usize ,
4952 pub ( crate ) block_confirmations : u64 ,
53+ /// Controls how many log-fetching RPC requests can run in parallel during the scan.
5054 pub ( crate ) max_concurrent_fetches : usize ,
5155}
5256pub struct SyncFromBlock {
5357 pub ( crate ) from_block : BlockId ,
5458 pub ( crate ) block_confirmations : u64 ,
59+ /// Controls how many log-fetching RPC requests can run in parallel during the scan.
5560 pub ( crate ) max_concurrent_fetches : usize ,
5661}
5762
@@ -138,18 +143,24 @@ impl EventScannerBuilder<Unspecified> {
138143 ///
139144 /// The scanner streams events in chronological order (oldest to newest) within the specified
140145 /// block range. Events are delivered in batches as they are fetched from the provider, with
141- /// batch sizes controlled by the `max_block_range` configuration.
146+ /// batch sizes controlled by the [ `max_block_range`][max_block_range] configuration.
142147 ///
143148 /// # Key behaviors
144149 ///
145150 /// * **Continuous streaming**: Events are delivered in multiple messages as they are fetched
146151 /// * **Chronological order**: Events are always delivered oldest to newest
152+ /// * **Concurrent log fetching**: Logs are fetched concurrently to reduce the execution time.
153+ /// The maximum number of concurrent RPC calls is controlled by
154+ /// [`max_concurrent_fetches`][max_concurrent_fetches]
147155 /// * **Default range**: By default, scans from `Earliest` to `Latest` block
148- /// * **Batch control**: Use `. max_block_range(n)` to control how many blocks are queried per
149- /// RPC call
156+ /// * **Batch control**: Use [` max_block_range`][max_block_range] to control how many blocks are
157+ /// queried per RPC call
150158 /// * **Reorg handling**: Performs reorg checks when streaming events from non-finalized blocks;
151159 /// if a reorg is detected, streams events from the reorged blocks
152160 /// * **Completion**: The scanner completes when the entire range has been processed.
161+ ///
162+ /// [max_block_range]: crate::EventScannerBuilder::max_block_range
163+ /// [max_concurrent_fetches]: crate::EventScannerBuilder::max_concurrent_fetches
153164 #[ must_use]
154165 pub fn historic ( ) -> EventScannerBuilder < Historic > {
155166 EventScannerBuilder :: default ( )
@@ -308,6 +319,9 @@ impl EventScannerBuilder<Unspecified> {
308319 /// message, chronologically ordered
309320 /// * **One-shot operation**: The scanner completes after delivering messages; it does not
310321 /// continue streaming
322+ /// * **Concurrent log fetching**: Logs are fetched concurrently to reduce the execution time.
323+ /// The maximum number of concurrent RPC calls is controlled by
324+ /// [`max_concurrent_fetches`][max_concurrent_fetches]
311325 /// * **Flexible count**: If fewer than `count` events exist in the range, returns all available
312326 /// events
313327 /// * **Default range**: By default, scans from `Earliest` to `Latest` block
@@ -349,6 +363,7 @@ impl EventScannerBuilder<Unspecified> {
349363 /// [sync_from_latest]: EventScannerBuilder::from_latest
350364 /// [reorg]: crate::Notification::ReorgDetected
351365 /// [no_logs]: crate::Notification::NoPastLogsFound
366+ /// [max_concurrent_fetches]: crate::EventScannerBuilder#method.max_concurrent_fetches-1
352367 #[ must_use]
353368 pub fn latest ( count : usize ) -> EventScannerBuilder < LatestEvents > {
354369 EventScannerBuilder :: < LatestEvents > :: new ( count)
0 commit comments