pub enum EntryBytes {
Extent {
offset: u64,
len: u64,
},
Owned(Vec<u8>),
}Expand description
Where an entry’s bytes are — an address into the archive, or bytes that exist nowhere else.
§Why this is not a Vec<u8>
It was one until 2026-08-14, and that single field is what made a clone hold
the whole repository. crate::git_ops::GitStore::emit_set filled it with a
pread into a fresh Vec::with_capacity(len) — one syscall, one allocation
and one kernel→user copy per object — and every one of those Vecs was
live at once, because the entries are all built before
emit_pack writes a byte. On a linux.git clone: ~13.8 M syscalls, ~27.6 M
allocations, 6.4 GB copied and held, and a peak RSS of 2314 MB against
gitea’s 122 MB on the identical clone
(gunnar/.nornir/forge-bakeoff-benchmarks.md, vs_forge_clone).
An Extent is 16 bytes and addresses bytes that are already
in the page cache. Resolving it is [crate::archive_map::Mapped::get] —
pointer arithmetic and a bounds check — with a pread fallback for the one
case a mapping cannot answer.
Variants§
Extent
The stored entry exactly as received, addressed in the archive’s
coordinate space. Header and all: offset is the entry’s type/size
varint and len runs to where the next entry starts.
This is what a full clone is made of, end to end. Nothing copies it until
emit_pack writes it to the wire.
Owned(Vec<u8>)
The exception: bytes that are on no disk.
Three shapes reach here, and every one of them genuinely computed bytes that no extent addresses:
- a delta whose base the request does not carry, rebuilt whole or
re-deltified against a base it does carry ([
Self::recompressed] —crate::delta); - an
OFS_DELTAre-headed as aREF_DELTAfor a client with noofs-deltacapability, or for a thin fetch — the payload is a copy but the header in front of it is new, so the concatenation is new; - a fixture built by hand in a test.
It is zero for a whole-repository clone, which is the measurement the extent form exists to make true rather than a promise this makes.
Implementations§
Source§impl EntryBytes
impl EntryBytes
Sourcepub fn len(&self) -> u64
pub fn len(&self) -> u64
How many bytes this entry contributes, without resolving it.
Free for an Extent — the length is the address — which
is what lets a caller size or account for a pack it has not read.
Trait Implementations§
Source§impl Clone for EntryBytes
impl Clone for EntryBytes
Source§fn clone(&self) -> EntryBytes
fn clone(&self) -> EntryBytes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EntryBytes
impl Debug for EntryBytes
impl Eq for EntryBytes
Source§impl PartialEq for EntryBytes
impl PartialEq for EntryBytes
impl StructuralPartialEq for EntryBytes
Auto Trait Implementations§
impl Freeze for EntryBytes
impl RefUnwindSafe for EntryBytes
impl Send for EntryBytes
impl Sync for EntryBytes
impl Unpin for EntryBytes
impl UnsafeUnpin for EntryBytes
impl UnwindSafe for EntryBytes
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.