pub struct Container { /* private fields */ }Expand description
One read-only ZIP container. Methods serialize access through &mut self.
Open does not certify contents. Backing files must remain unchanged.
Implementations§
Source§impl Container
impl Container
Sourcepub fn disk_images(&self) -> Result<Vec<DiskImageInfo>>
pub fn disk_images(&self) -> Result<Vec<DiskImageInfo>>
Enumerates explicitly typed physical images in a single AFF4 1.0 volume. Storage streams, logical files, and memory images are not disk candidates. Invalid image sizes or contradictory block sizes are errors, not omissions.
Sourcepub fn into_disk_reader(self, resource: Option<&str>) -> Result<DiskImageReader>
pub fn into_disk_reader(self, resource: Option<&str>) -> Result<DiskImageReader>
Selects a physical image by identifier and transfers this container to a cursor.
With None, exactly one disk candidate is required. Selection never chooses
an underlying ImageStream or Map. Opening does not verify the whole image.
Source§impl Container
impl Container
Sourcepub fn verify_metadata(
&mut self,
expected_sha256: Option<&str>,
) -> Result<MetadataVerification>
pub fn verify_metadata( &mut self, expected_sha256: Option<&str>, ) -> Result<MetadataVerification>
Verifies exact metadata bytes using draft RDF and legacy Gemino JSON hashes.
Both representations are checked when present; conflicts cannot be hidden
by preferring one. Imported metadata is checked against its RDF references.
expected_sha256 is an independently recorded information.turtle digest.
This does not hash the ZIP archive or verify evidence streams/signatures.
Source§impl Container
impl Container
Sourcepub fn verify_all(
&mut self,
expected_metadata_sha256: Option<&str>,
progress: impl FnMut(&str, u64, u64) -> ControlFlow<()>,
) -> Result<ContainerVerification>
pub fn verify_all( &mut self, expected_metadata_sha256: Option<&str>, progress: impl FnMut(&str, u64, u64) -> ControlFlow<()>, ) -> Result<ContainerVerification>
Checks metadata and all data resources, continuing after individual failures. Progress cancellation aborts the entire operation. Unknown digest semantics are reported as unsupported, never inferred from the digest length.
Source§impl Container
impl Container
Sourcepub fn scan_metadata(
path: impl AsRef<Path>,
limits: Limits,
visit: impl FnMut(&str, &str, &Property) -> ControlFlow<()>,
) -> Result<MetadataScan>
pub fn scan_metadata( path: impl AsRef<Path>, limits: Limits, visit: impl FnMut(&str, &str, &Property) -> ControlFlow<()>, ) -> Result<MetadataScan>
Streams primary and imported RDF statements without constructing a graph. Subject order is arbitrary; callers must not assume adjacent statements describe a complete object. The callback receives source-member provenance. This is an inventory operation, not content or metadata verification. ZIP directory and entry limits are checked before ZIP parsing.
Source§impl Container
impl Container
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Opens a standard v1 ZIP container with default resource limits.
Sourcepub fn open_with_limits(path: impl AsRef<Path>, limits: Limits) -> Result<Self>
pub fn open_with_limits(path: impl AsRef<Path>, limits: Limits) -> Result<Self>
Opens a container, validates its version, and parses bounded RDF metadata. External RDF references are never fetched over the network.
Sourcepub fn metadata(&self) -> &BTreeMap<String, Vec<Property>>
pub fn metadata(&self) -> &BTreeMap<String, Vec<Property>>
Preserves all parsed RDF properties, including unsupported extensions.
Sourcepub fn version(&self) -> (u32, u32)
pub fn version(&self) -> (u32, u32)
Declared container version; 2.1 refers to the evolving AFF4-L draft.
Sourcepub fn reader_statistics(&self) -> ReaderStatistics
pub fn reader_statistics(&self) -> ReaderStatistics
Returns cumulative decoded-chunk reader counters.
Sourcepub fn reader_cache_info(&self) -> ReaderCacheInfo
pub fn reader_cache_info(&self) -> ReaderCacheInfo
Returns automatic decoded-chunk cache usage.
Sourcepub fn streams(&self) -> Result<Vec<StreamInfo>>
pub fn streams(&self) -> Result<Vec<StreamInfo>>
Enumerates image resources and storage streams. Selection is never implicit.
Sourcepub fn size(&self, id: &str) -> Result<u64>
pub fn size(&self, id: &str) -> Result<u64>
Returns the size of a selected resource, resolving its dataStream reference.
Sourcepub fn read_at(
&mut self,
id: &str,
buffer: &mut [u8],
offset: u64,
) -> Result<usize>
pub fn read_at( &mut self, id: &str, buffer: &mut [u8], offset: u64, ) -> Result<usize>
Reads a selected stream at a byte offset. Missing targets, cycles, corrupt chunks, and unknown/unreadable symbolic data return errors.
Sourcepub fn sequential_reader(&mut self, id: &str) -> Result<Box<dyn Read + '_>>
pub fn sequential_reader(&mut self, id: &str) -> Result<Box<dyn Read + '_>>
Reads a resource sequentially. ZIP segments, including those behind identity maps, retain one decompressor across reads; other resources use positioned reads through their maps. The caller must read the declared size to detect a truncated stream.
Sourcepub fn verify(
&mut self,
id: &str,
progress: impl FnMut(u64, u64) -> ControlFlow<()>,
) -> Result<Verification>
pub fn verify( &mut self, id: &str, progress: impl FnMut(u64, u64) -> ControlFlow<()>, ) -> Result<Verification>
Computes linear hashes with progress and cancellation. Does not verify block hashes, map hashes, signatures, or metadata integrity.
Sourcepub fn copy_verified(
&mut self,
id: &str,
output: &mut impl Write,
progress: impl FnMut(u64, u64) -> ControlFlow<()>,
) -> Result<Verification>
pub fn copy_verified( &mut self, id: &str, output: &mut impl Write, progress: impl FnMut(u64, u64) -> ControlFlow<()>, ) -> Result<Verification>
Copies exact logical bytes while computing and comparing linear hashes.
The caller owns staging/publication and must inspect references_match.
Partial output may remain in the sink after any failure or cancellation.
Auto Trait Implementations§
impl Freeze for Container
impl RefUnwindSafe for Container
impl Send for Container
impl Sync for Container
impl Unpin for Container
impl UnsafeUnpin for Container
impl UnwindSafe for Container
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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