Skip to main content

IndexedPack

Struct IndexedPack 

Source
pub struct IndexedPack {
    pub num_objects: u32,
    pub pack_id: ObjectId,
    pub index_id: ObjectId,
    pub pack_version: PackVersion,
    pub hash_kind: Kind,
    pub index_path: Option<PathBuf>,
    pub data_path: Option<PathBuf>,
    pub stored_bytes: Option<u64>,
    pub keep_path: Option<PathBuf>,
}
Expand description

What came out of taking a pushed pack into storage.

A receipt, not a handle: every field is a fact read back off what was stored, and nothing here reaches into the store to answer. The three Option<PathBuf>s are None on every engine that does not keep git’s on-disk layout — which is the default one — and None there is the truth rather than a degraded answer.

Fields§

§num_objects: u32

How many objects the resulting pack holds.

For a thin pack this is larger than the number of entries that arrived on the wire: bases pulled in from the store to complete it are counted too.

§pack_id: ObjectId

The pack’s trailing checksum, which is its identity and the <id> in pack-<id>.pack.

§index_id: ObjectId

The checksum of the written index file, or a null id where no index file exists.

§pack_version: PackVersion

The pack format version that was read.

§hash_kind: Kind

The hash kind of the pack and index.

§index_path: Option<PathBuf>

Where the .idx landed, if one was written.

§data_path: Option<PathBuf>

Where the .pack landed, if one was written.

§stored_bytes: Option<u64>

How many bytes the stored pack occupies, when the store knows and there is no file to stat.

§Why this is not the same question as data_path

A packfile engine answers “how big is the pack that landed” by measuring the file it wrote. An engine that writes no packfile — the znippy store appends the received bytes VERBATIM into its archive — has no file, and for a while that made the whole measurement an unknown: every push into the engine gunnar ships logged pack_bytes_unknown="pack … was indexed without a directory".

That was false. The store counts the bytes it appends (PushReceipt::pack_bytes); nobody carried the number this far. An absence rendered where a measurement exists is the same defect as a measurement rendered where an absence exists, and it is worse here, because a reader is told gunnar does not know something it does.

None means “ask data_path” — the pack IS a file and its size is that file’s size, which is the truer answer for an engine that has one. It still means genuinely unknown when there is no file either, and callers must keep reporting that as unknown rather than as zero: rendering the missing file as new_object_bytes: 0 reads as a push that stored nothing, in the one record a verifier is supposed to be able to trust.

§keep_path: Option<PathBuf>

The .keep file guarding the new pack from collection until refs point at it. The caller owns it and is expected to remove it once the ref transaction is applied.

Trait Implementations§

Source§

impl Clone for IndexedPack

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IndexedPack

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for IndexedPack

Source§

impl PartialEq for IndexedPack

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IndexedPack

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more