Skip to main content

TreeSource

Trait TreeSource 

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

Where a tree’s bytes come from — a lookup, not a table, keyed by the raw oid.

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 held on disk so that map could be rebuilt into RAM on every fold; peak RSS 50.9 GiB on a 16 GB appliance. So the map became a lookup, and the store’s arm resolves a tree the way any other read does.

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 treats it as “stop here”.

Required Methods§

Source

fn tree(&self, oid: &[u8]) -> 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 keyed by hex (the sealed builder and the tests): one encode per tree visited, never per entry.

Source§

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

Source§

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

Source§

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

Implementors§