pub struct ExplodedArchive { /* private fields */ }Expand description
§14’s derived table for one repository.
Implementations§
Source§impl ExplodedArchive
impl ExplodedArchive
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open or create the table, with the policy ZNIPPY_GIT_EXPLODE names.
Reads kilobytes, never the payloads.
Sourcepub fn open_with_policy(path: &Path, policy: ExplodePolicy) -> Result<Self>
pub fn open_with_policy(path: &Path, policy: ExplodePolicy) -> Result<Self>
Open with an explicit policy — what a test or a per-tenant configuration uses, so the setting is not reachable only through the environment.
pub fn path(&self) -> &Path
Sourcepub fn explode(
&self,
oid: &[u8],
kind: GitObjectKind,
payload: &[u8],
) -> Result<()>
pub fn explode( &self, oid: &[u8], kind: GitObjectKind, payload: &[u8], ) -> Result<()>
One resolved object with no name attached — what crate::exploded::PayloadSink
can supply.
Sourcepub fn explode_at(
&self,
oid: &[u8],
kind: GitObjectKind,
mode: Option<u32>,
path: Option<&str>,
payload: &[u8],
) -> Result<()>
pub fn explode_at( &self, oid: &[u8], kind: GitObjectKind, mode: Option<u32>, path: Option<&str>, payload: &[u8], ) -> Result<()>
One resolved object with its name: the mode and path a tree walk knows.
A blob is reachable at many paths, so this records the first one seen and never rewrites it — a row that already exists is not re-keyed by a second sighting, because “which of its names” is not a question this table pretends to answer.
Sourcepub fn flush(&self) -> Result<u64>
pub fn flush(&self) -> Result<u64>
Append the buffered rows as ONE batch message. Nothing already in the file is read or rewritten.
Sourcepub fn content(&self, oid: &[u8]) -> Result<Option<(GitObjectKind, Vec<u8>)>>
pub fn content(&self, oid: &[u8]) -> Result<Option<(GitObjectKind, Vec<u8>)>>
The object’s kind and bytes, or None — fall back and rebuild, never
wrong.
Sourcepub fn pread_served(&self) -> u64
pub fn pread_served(&self) -> u64
Point reads served by the extent pread rather than a batch decode —
how a test proves the fast path is the one actually taken, instead of
timing something.
Sourcepub fn name(&self, oid: &[u8]) -> Result<Option<(Option<u32>, Option<String>)>>
pub fn name(&self, oid: &[u8]) -> Result<Option<(Option<u32>, Option<String>)>>
The name this object was first exploded at, if any caller knew one.
None is “not recorded”, never “at the root”.
pub fn has(&self, oid: &[u8]) -> Result<bool>
Sourcepub fn of_kind(&self, kind: GitObjectKind) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
pub fn of_kind(&self, kind: GitObjectKind) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
Every oid of one kind, with its payload. The graph fold’s input.
Driven by the index, not by a scan of the file, because the file
holds superseded and retired rows too. A scan that read the file directly
is exactly how gc’d commits came back after a reopen.
Sourcepub fn retain(&self, live: &dyn Fn(&[u8]) -> bool) -> Result<u64>
pub fn retain(&self, live: &dyn Fn(&[u8]) -> bool) -> Result<u64>
Retire every oid live rejects, durably.
The file is append-only, so this appends a TOMBSTONE row per retired
oid rather than deleting anything. The bytes of the dead rows stay until
the table is rebuilt — reclaiming them means rewriting up to 17 GB, which
is a job with its own proof obligations and not something to smuggle into
gc — but the rows are gone from every reader, including a reopened
one.
Dropping only from the in-memory index is what a first cut did. Seen RED
by store::tests::a_wholly_dead_pack_does_not_come_back_when_the_store_is_reopened:
“the graph after gc + reopen holds 551 commits, not the one live one”.
Sourcepub fn rows(&self) -> Result<u64>
pub fn rows(&self) -> Result<u64>
Rows in the table. Answered from batch metadata when no index has been built, so startup does not read a payload.
Sourcepub fn disk_bytes(&self) -> u64
pub fn disk_bytes(&self) -> u64
Bytes the table occupies — the number redb could not keep anywhere near its payload total.
pub fn note_rederived(&self)
Sourcepub fn policy(&self) -> ExplodePolicy
pub fn policy(&self) -> ExplodePolicy
What this table is configured to keep.
Sourcepub fn skipped(&self) -> u64
pub fn skipped(&self) -> u64
Objects the policy declined, COUNTED: a table short because of policy and
one short because of a fault must not look alike to adopt_journal.
pub fn stats(&self) -> Stats
Sourcepub fn engine_stats(&self) -> ExplodedStats
pub fn engine_stats(&self) -> ExplodedStats
The engine-wide counter type, so no caller can tell the medium apart by its instruments.