pub struct FileStream<M = Writer>where
M: FilesMode,{ /* private fields */ }Expand description
An open file. A file never changes its bytes, so nothing later changes what it reads. Its shared store lock prevents deletion until the stream and its I/O finish, including reads still running after the store closes or the caller cancels.
Implementations§
Source§impl<M> FileStream<M>where
M: FilesMode,
impl<M> FileStream<M>where
M: FilesMode,
Sourcepub fn plaintext_size(&self) -> u64
pub fn plaintext_size(&self) -> u64
Complete plaintext size.
Sourcepub async fn read_at(
&self,
offset: u64,
len: u64,
) -> Result<Vec<u8>, FileReadError>
pub async fn read_at( &self, offset: u64, len: u64, ) -> Result<Vec<u8>, FileReadError>
Read exactly the requested range. Network requests cover only missing
chunks, batching adjacent chunks within 1 MiB. Use read_range to keep
returned plaintext bounded independently of the requested range length.
Sourcepub async fn read_at_reporting(
&self,
offset: u64,
len: u64,
progress: &ReadProgress,
) -> Result<Vec<u8>, FileReadError>
pub async fn read_at_reporting( &self, offset: u64, len: u64, progress: &ReadProgress, ) -> Result<Vec<u8>, FileReadError>
Self::read_at, telling progress how many of the range’s bytes are
here each time that grows while the read fetches from storage. A read
served from this device’s copy or the cache tells it nothing.
Sourcepub fn read_range(
&self,
offset: u64,
len: u64,
) -> Result<FileRangeStream<'_, M>, FileReadError>
pub fn read_range( &self, offset: u64, len: u64, ) -> Result<FileRangeStream<'_, M>, FileReadError>
Stream a byte range in bounded plaintext buffers, authenticating each fetched chunk before yielding its bytes. For a stored file, the final buffer checks the whole-file hash when reading sequentially from zero through the end.
Auto Trait Implementations§
impl<M = Writer> !Freeze for FileStream<M>
impl<M = Writer> !RefUnwindSafe for FileStream<M>
impl<M> Send for FileStream<M>
impl<M> Sync for FileStream<M>
impl<M> Unpin for FileStream<M>
impl<M> UnsafeUnpin for FileStream<M>
impl<M = Writer> !UnwindSafe for FileStream<M>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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