Struct async_fetcher::Fetcher
source · [−]pub struct Fetcher<Data> { /* private fields */ }
Expand description
An asynchronous file fetcher for clients fetching files.
The futures generated by the fetcher are compatible with single and multi-threaded runtimes, allowing you to choose between the runtime that works best for your application. A single-threaded runtime is generally recommended for fetching files, as your network connection is unlikely to be faster than a single CPU core.
Implementations
sourceimpl<Data> Fetcher<Data>
impl<Data> Fetcher<Data>
sourcepub fn connections_per_file(self, value: u16) -> Self
pub fn connections_per_file(self, value: u16) -> Self
The number of concurrent connections to sustain per file being fetched.
Note
Defaults to 1 connection
sourcepub fn delay_between_requests(self, value: u64) -> Self
pub fn delay_between_requests(self, value: u64) -> Self
sourcepub fn max_part_size(self, value: u32) -> Self
pub fn max_part_size(self, value: u32) -> Self
sourcepub fn progress_interval(self, value: u64) -> Self
pub fn progress_interval(self, value: u64) -> Self
sourcepub fn timeout(self, value: Duration) -> Self
pub fn timeout(self, value: Duration) -> Self
The time to wait between chunks before giving up.
sourceimpl<Data: Send + Sync + 'static> Fetcher<Data>
impl<Data: Send + Sync + 'static> Fetcher<Data>
sourcepub fn stream_from(
self: Arc<Self>,
inputs: impl Stream<Item = (Source, Arc<Data>)> + Send + 'static,
concurrent: usize
) -> Pin<Box<dyn Stream<Item = AsyncFetchOutput<Data>> + Send + 'static>>
pub fn stream_from(
self: Arc<Self>,
inputs: impl Stream<Item = (Source, Arc<Data>)> + Send + 'static,
concurrent: usize
) -> Pin<Box<dyn Stream<Item = AsyncFetchOutput<Data>> + Send + 'static>>
Given an input stream of source fetches, returns an output stream of fetch results.
Spawns up to concurrent
+ 1
number of concurrent async tasks on the runtime.
One task for managing the fetch tasks, and one task per fetch request.
Trait Implementations
Auto Trait Implementations
impl<Data> !RefUnwindSafe for Fetcher<Data>
impl<Data> Send for Fetcher<Data> where
Data: Send + Sync,
impl<Data> Sync for Fetcher<Data> where
Data: Send + Sync,
impl<Data> Unpin for Fetcher<Data>
impl<Data> !UnwindSafe for Fetcher<Data>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more