pub struct Snapshot<'a> {
pub flags: u16,
pub created_at: u64,
/* private fields */
}Expand description
A parsed, validated snapshot borrowing the input buffer.
Fields§
§flags: u16Header flags (see FLAG_VECTORS).
created_at: u64Creation timestamp as written (informational).
Implementations§
Source§impl<'a> Snapshot<'a>
impl<'a> Snapshot<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, Error>
pub fn parse(bytes: &'a [u8]) -> Result<Self, Error>
Parses and structurally validates a snapshot file (trust model in the
module docs): framing, canonical layout and bounds only. The container
xxh3 checksums are not verified here — that is on demand, in slices,
via Snapshot::scrub. Content pools (text, vectors)
are validated lazily too; see Memory::verify.
§Errors
Error::UnsupportedVersion for a foreign format version;
Error::Corrupt for everything else that fails structural validation.
Sourcepub fn config(&self) -> &'a [u8]
pub fn config(&self) -> &'a [u8]
The binary config block (decode with
Config::decode).
Sourcepub fn section(&self, kind: u16) -> Option<&'a [u8]>
pub fn section(&self, kind: u16) -> Option<&'a [u8]>
The bytes of one section, or None when the file has no section of
that kind.
Sourcepub fn engine_ver(&self) -> &'a str
pub fn engine_ver(&self) -> &'a str
The engine version string the file was written by (informational).
Sourcepub fn scrub(&self) -> ScrubCursor<'a> ⓘ
pub fn scrub(&self) -> ScrubCursor<'a> ⓘ
A resumable container-checksum scan of this snapshot with the default
slice budget (DEFAULT_SCRUB_BUDGET). See ScrubCursor.
Sourcepub fn scrub_with_budget(&self, budget: usize) -> ScrubCursor<'a> ⓘ
pub fn scrub_with_budget(&self, budget: usize) -> ScrubCursor<'a> ⓘ
A resumable container-checksum scan hashing at most budget bytes per
Iterator::next. See ScrubCursor.