Skip to main content

materialize_at

Function materialize_at 

Source
pub fn materialize_at(
    archive: &dyn ArchiveBytes,
    at: u64,
    oid_len: usize,
    offset_of_oid: &dyn Fn(&[u8]) -> Option<u64>,
    bases: &dyn BaseSource,
) -> Result<(GitObjectKind, Vec<u8>, ReadCost)>
Expand description

One object’s content, with only its own chain inflated, addressed by archive offset.

This is the lazy-explode read path (ideas/lazy-explode-index-only-at-push.md). The eager tier’s alternative was to read the whole containing pack back and re-resolve it — for torvalds/linux an 8.12 GiB read and a 13.9 M-object resolve per object served, which is why the exploded tier had to be built eagerly at push time and why that tier reached 141.7 GiB. Reading a chain instead costs d inflates and d − 1 delta applications and touches nothing else in the pack.

  • at — the entry’s absolute archive offset, from the objects table’s offset column (or from a pending pack’s scan).
  • offset_of_oid — resolves a REF_DELTA’s base oid to an archive offset; the objects index answers it.
  • bases — answers a REF_DELTA base the index does not hold (a thin pack’s external base). None from it is ResolveError::missing_base, refused by name, never guessed.

Nothing is cached and nothing is written: the caller decides whether the bytes are worth keeping. That separation is what lets the write-back happen off the reader’s path.