pub struct MultiDirectoryFileAccess { /* private fields */ }Expand description
A FileAccess that searches multiple directories for files.
When reading a file, directories are searched in order: primary first, then each additional search directory. The first directory containing the file wins. Writes always go to the primary directory.
Implementations§
Source§impl MultiDirectoryFileAccess
impl MultiDirectoryFileAccess
Sourcepub fn new(
primary_dir: PathBuf,
search_dirs: Vec<PathBuf>,
par2_set: &Par2FileSet,
) -> Self
pub fn new( primary_dir: PathBuf, search_dirs: Vec<PathBuf>, par2_set: &Par2FileSet, ) -> Self
Create a new multi-directory accessor.
primary_dir is the main directory for reads and writes.
search_dirs are additional directories to search when a file isn’t found
in the primary (e.g., directories from duplicate NZB downloads).
Trait Implementations§
Source§impl FileAccess for MultiDirectoryFileAccess
impl FileAccess for MultiDirectoryFileAccess
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 MultiDirectoryFileAccess
impl RefUnwindSafe for MultiDirectoryFileAccess
impl Send for MultiDirectoryFileAccess
impl Sync for MultiDirectoryFileAccess
impl Unpin for MultiDirectoryFileAccess
impl UnsafeUnpin for MultiDirectoryFileAccess
impl UnwindSafe for MultiDirectoryFileAccess
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