Skip to main content

ExplodedArchive

Struct ExplodedArchive 

Source
pub struct ExplodedArchive { /* private fields */ }
Expand description

§14’s derived table for one repository.

Implementations§

Source§

impl ExplodedArchive

Source

pub fn open(path: &Path) -> Result<Self>

Open or create the table, with the policy ZNIPPY_GIT_EXPLODE names. Reads kilobytes, never the payloads.

Source

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.

Source

pub fn path(&self) -> &Path

Source

pub fn explode( &self, oid: &[u8], kind: GitObjectKind, payload: &[u8], ) -> Result<()>

One resolved object with no name attached — what crate::exploded::PayloadSink can supply.

Source

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.

Source

pub fn flush(&self) -> Result<u64>

Append the buffered rows as ONE batch message. Nothing already in the file is read or rewritten.

Source

pub fn content(&self, oid: &[u8]) -> Result<Option<(GitObjectKind, Vec<u8>)>>

The object’s kind and bytes, or Nonefall back and rebuild, never wrong.

Source

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.

Source

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”.

Source

pub fn has(&self, oid: &[u8]) -> Result<bool>

Source

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.

Source

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”.

Source

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.

Source

pub fn disk_bytes(&self) -> u64

Bytes the table occupies — the number redb could not keep anywhere near its payload total.

Source

pub fn note_rederived(&self)

Source

pub fn policy(&self) -> ExplodePolicy

What this table is configured to keep.

Source

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.

Source

pub fn stats(&self) -> Stats

Source

pub fn engine_stats(&self) -> ExplodedStats

The engine-wide counter type, so no caller can tell the medium apart by its instruments.

Trait Implementations§

Source§

impl PayloadSink for ExplodedArchive

Source§

fn explode(&self, oid: &[u8], kind: GitObjectKind, payload: &[u8]) -> Result<()>

One resolved object: its oid, the type its chain resolves to, and the inflated payload. Called once per pack entry, never for a delta’s intermediate state.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.