pub struct RandomAccessReader { /* private fields */ }Expand description
Implements AsyncRead and AsyncSeek
This reader allows for random access on the BLOB.
Random access on a remote BLOB via a reader is a rather unusual case and is provided to interface with libraries which are based on reading data via AsyncRead and AsyncSeek.
§Behaviour
The download is initiated once the first bytes have been queried from the reader. Seek does not intiate a download but currently forces a new download to be started once the reader is polled for bytes again.
The BLOB is only downloaded concurrently if prefetching is enabled via FetchAheadMode::Bytes or FetchAheadMode::ToEnd. The In these cases the number of bytes to be downloaded must be greater than the configured part size for concurrent downloading.
Implementations§
Source§impl RandomAccessReader
impl RandomAccessReader
Sourcepub fn new<F, FM>(
get_reader: F,
bounds: InclusiveRange,
fetch_ahead_mode: FM,
) -> Selfwhere
F: Fn(InclusiveRange) -> BoxFuture<'static, Result<BytesAsyncReader, CondowError>> + Send + Sync + 'static,
FM: Into<FetchAheadMode>,
pub fn new<F, FM>(
get_reader: F,
bounds: InclusiveRange,
fetch_ahead_mode: FM,
) -> Selfwhere
F: Fn(InclusiveRange) -> BoxFuture<'static, Result<BytesAsyncReader, CondowError>> + Send + Sync + 'static,
FM: Into<FetchAheadMode>,
Will create a reader with the given known size of the BLOB.
Source§impl RandomAccessReader
impl RandomAccessReader
pub fn set_fetch_ahead_mode<T: Into<FetchAheadMode>>(&mut self, mode: T)
pub fn fetch_ahead_mode(&self) -> FetchAheadMode
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RandomAccessReader
impl !RefUnwindSafe for RandomAccessReader
impl Send for RandomAccessReader
impl !Sync for RandomAccessReader
impl Unpin for RandomAccessReader
impl !UnwindSafe for RandomAccessReader
Blanket Implementations§
Source§impl<R> AsyncReadExt for R
impl<R> AsyncReadExt for R
Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
Source§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
buf in asynchronous
manner, returning a future type. Read moreSource§fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
AsyncRead into bufs using vectored
IO operations. Read moreSource§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
buf,
returning an error if end of file (EOF) is hit sooner. Read moreSource§fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
AsyncRead. Read moreSource§fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
AsyncRead. Read more