pub struct GitOidIndex { /* private fields */ }Expand description
Reader over a __gunnar_oid__ section.
Implementations§
Source§impl GitOidIndex
impl GitOidIndex
Sourcepub fn open(archive: &Path) -> Result<Option<Self>>
pub fn open(archive: &Path) -> Result<Option<Self>>
Read the section out of a sealed archive. Ok(None) when the archive
carries no oid index (i.e. it is not a git-format archive).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn hash_kind(&self) -> GitHashKind
Sourcepub fn candidate_run(&self, key: i64) -> Range<usize>
pub fn candidate_run(&self, key: i64) -> Range<usize>
The unverified candidate run for a key: every entry sharing that
8-byte prefix, as start..end. Normally length 1; length > 1 is a real
prefix collision.
Exposed so a test can assert that a collision actually produces a run of
two and that the verify step is what tells the two oids apart. A caller
resolving an oid should use lookup, never this.
Sourcepub fn lookup(&self, oid: &[u8]) -> Option<OidHit>
pub fn lookup(&self, oid: &[u8]) -> Option<OidHit>
Resolve a raw oid. None when absent.
stree narrows to a candidate run; the full oid is then compared against every candidate. Skipping that comparison would return a different object’s row whenever two oids share their first eight bytes.
Sourcepub fn lookup_hex(&self, hex_oid: &str) -> Option<OidHit>
pub fn lookup_hex(&self, hex_oid: &str) -> Option<OidHit>
Resolve a hex oid.
Sourcepub fn lookup_batch(&self, oids: &[&[u8]]) -> Vec<Option<OidHit>>
pub fn lookup_batch(&self, oids: &[&[u8]]) -> Vec<Option<OidHit>>
Resolve many oids at once through stree’s software-pipelined batch traversal. This is the path that matters: serving one pack is hundreds to thousands of lookups, and the pipelined walk overlaps their memory latency instead of paying it serially.
Results are positional — out[i] corresponds to oids[i]. Every hit is
full-oid verified, exactly as in lookup.
Sourcepub fn lookup_batch_hex(&self, hex_oids: &[&str]) -> Vec<Option<OidHit>>
pub fn lookup_batch_hex(&self, hex_oids: &[&str]) -> Vec<Option<OidHit>>
Hex convenience over lookup_batch.