pub struct StreamingFetcher { /* private fields */ }Expand description
Streaming fetcher for large datasets with checkpoint support
Implementations§
Source§impl StreamingFetcher
impl StreamingFetcher
Sourcepub fn with_checkpoint(self, path: &Path) -> Result<Self>
pub fn with_checkpoint(self, path: &Path) -> Result<Self>
Enable checkpointing
Sourcepub fn endpoint_count(&self) -> usize
pub fn endpoint_count(&self) -> usize
Get endpoint count
Sourcepub async fn fetch_streaming<F>(&mut self, handler: F) -> Result<FetchStats>
pub async fn fetch_streaming<F>(&mut self, handler: F) -> Result<FetchStats>
Fetch logs with streaming output, calling handler for each chunk Returns aggregated stats
§Output Order
Important: Chunks are processed in completion order, not block order. This means logs from later blocks may be written before logs from earlier blocks. This is a design choice to maximize throughput - using ordered streams would significantly reduce parallelism benefits.
If you need block-ordered output:
- Use
LogFetcher::fetch_all()which sorts results before returning - Or post-process the output file to sort by block number
Uses parallel fetching with buffer_unordered for improved performance
while maintaining sequential handler calls for checkpoint consistency.
Sourcepub async fn stream(self, tx: Sender<Result<FetchResult>>) -> Result<FetchStats>
pub async fn stream(self, tx: Sender<Result<FetchResult>>) -> Result<FetchStats>
Stream logs through a bounded channel (for async consumers)
Note: Uses try_send to avoid potential deadlock with blocking_send.
If channel is full, returns an error. For guaranteed delivery, use
stream_unbounded instead.
Sourcepub async fn stream_unbounded(
self,
tx: UnboundedSender<Result<FetchResult>>,
) -> Result<FetchStats>
pub async fn stream_unbounded( self, tx: UnboundedSender<Result<FetchResult>>, ) -> Result<FetchStats>
Stream logs through an unbounded channel (for async consumers)
RUST-003 fix: This variant uses an unbounded channel to avoid potential deadlock issues. The unbounded channel will never block on send, but memory usage is unbounded if the receiver is slow.
Auto Trait Implementations§
impl Freeze for StreamingFetcher
impl !RefUnwindSafe for StreamingFetcher
impl Send for StreamingFetcher
impl Sync for StreamingFetcher
impl Unpin for StreamingFetcher
impl !UnwindSafe for StreamingFetcher
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> 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