Skip to main content

TreeSource

Trait TreeSource 

Source
pub trait TreeSource: Sync {
    // Required method
    fn tree(&self, oid_hex: &str) -> Option<Cow<'_, [u8]>>;
}
Expand description

Where a tree’s bytes come from — a lookup, not a table.

It was &HashMap<String, Vec<u8>>: every tree payload in the repository, resident, keyed by a hex String. MEASURED on oden 2026-08-30, the real torvalds/linux mirror through crate::git_ops::GitStore: 28.24 GB of tree payloads — 3.24× the 8.13 GiB pack — held on disk in the eager exploded pool so that this map could be rebuilt into RAM on every fold. Peak RSS 50.9 GiB. The appliance has 16.

So the map became a lookup. The eager arm is still a HashMap and costs exactly what it did (Cow::Borrowed, no copy); the store’s arm resolves the tree the way any other read does — from the exploded cache if it is there, by inflating its own delta chain out of the mmapped pack if it is not (crate::resolve::materialize_at) — and the walk then puts it in the cache for the next one.

None is “not a tree this archive holds” and is an ordinary answer, not a fault: a blob is a leaf, a gitlink is a commit in another repository, and a thin push’s base may be outside the archive. Every caller below treats it as “stop here”, which is what it always meant.

Required Methods§

Source

fn tree(&self, oid_hex: &str) -> Option<Cow<'_, [u8]>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TreeSource for HashMap<String, Vec<u8>>

The eager arm: a map that is already in memory. Unchanged in cost — the Cow borrows, so no payload is copied to satisfy the trait.

Source§

fn tree(&self, oid_hex: &str) -> Option<Cow<'_, [u8]>>

Implementors§