pub struct PlacementFileAccess { /* private fields */ }Expand description
A FileAccess that reads files through placement overrides.
Verification can use this to resolve a PAR2 file ID to the file currently holding that content without mutating filenames on disk.
Implementations§
Source§impl PlacementFileAccess
impl PlacementFileAccess
pub fn new( base_dir: PathBuf, par2_set: &Par2FileSet, overrides: HashMap<FileId, String>, ) -> Self
pub fn from_plan( base_dir: PathBuf, par2_set: &Par2FileSet, plan: &PlacementPlan, ) -> Self
Trait Implementations§
Source§impl FileAccess for PlacementFileAccess
impl FileAccess for PlacementFileAccess
Source§fn read_file_range(
&self,
file_id: &FileId,
offset: u64,
len: u64,
) -> Result<Vec<u8>>
fn read_file_range( &self, file_id: &FileId, offset: u64, len: u64, ) -> Result<Vec<u8>>
Read a range of bytes from a file identified by its FileId.
Source§fn read_file_range_into(
&self,
file_id: &FileId,
offset: u64,
dst: &mut [u8],
) -> Result<usize>
fn read_file_range_into( &self, file_id: &FileId, offset: u64, dst: &mut [u8], ) -> Result<usize>
Read bytes into a caller-provided buffer, returning the number of bytes read.
Source§fn open_sequential_reader(
&self,
file_id: &FileId,
) -> Result<Option<Box<dyn Read>>>
fn open_sequential_reader( &self, file_id: &FileId, ) -> Result<Option<Box<dyn Read>>>
Open a forward-only reader for hot paths that consume a whole file from offset 0.
Source§fn open_range_reader(
&self,
file_id: &FileId,
) -> Result<Option<Box<dyn FileRangeReader>>>
fn open_range_reader( &self, file_id: &FileId, ) -> Result<Option<Box<dyn FileRangeReader>>>
Open a reusable seekable reader for range-oriented repair input.
Source§fn file_exists(&self, file_id: &FileId) -> bool
fn file_exists(&self, file_id: &FileId) -> bool
Check if a file exists on disk.
Auto Trait Implementations§
impl Freeze for PlacementFileAccess
impl RefUnwindSafe for PlacementFileAccess
impl Send for PlacementFileAccess
impl Sync for PlacementFileAccess
impl Unpin for PlacementFileAccess
impl UnsafeUnpin for PlacementFileAccess
impl UnwindSafe for PlacementFileAccess
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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