pub struct Archive<R: ?Sized> { /* private fields */ }Expand description
A DwarFS archive wrapping reader R.
Usually, you create a pair of Archive and ArchiveIndex using
Archive::new. Directory hierarchy traversal can be done only on
ArchiveIndex, and this struct is only needed for reading file content.
See also ArchiveIndex.
Implementations§
Source§impl<R: ReadAt + Size> Archive<R>
impl<R: ReadAt + Size> Archive<R>
Sourcepub fn new(rdr: R) -> Result<(ArchiveIndex, Self)>
pub fn new(rdr: R) -> Result<(ArchiveIndex, Self)>
Load a DwarFS archive from a random-access stream,
typically a std::fs::File.
Note 1: Do not use BufReader, because
Archive already has internal caches. Use
Config::block_cache_size_limit to configure its size.
Note 2: It’s discouraged to use positioned_io::RandomAccessFile on *NIX
platforms because that would disable readahead which can hurt performance on
sequential read inside a several MiB section.
On Windows, however, RandomAccessFile is several times faster than File.
Sourcepub fn new_with_config(rdr: R, config: &Config) -> Result<(ArchiveIndex, Self)>
pub fn new_with_config(rdr: R, config: &Config) -> Result<(ArchiveIndex, Self)>
Same as Archive::new but with a non-default Config.
Sourcepub fn new_with_index_and_config(
rdr: SectionReader<R>,
index: &ArchiveIndex,
config: &Config,
) -> Result<Self>
pub fn new_with_index_and_config( rdr: SectionReader<R>, index: &ArchiveIndex, config: &Config, ) -> Result<Self>
The low-level method for creating an Archive with already parsed ArchiveIndex.