pub struct PackWriteOptions {
pub window: usize,
pub depth: usize,
pub prefer_ofs_delta: bool,
pub thin_bases: HashMap<ObjectId, EncodedObject>,
pub reorder: bool,
}Expand description
Options controlling sliding-window delta selection during pack generation.
Construct with PackWriteOptions::new (sensible defaults) and adjust with
the builder-style setters, or build one directly. Used by
PackFile::write_packed_with_options and PackFile::write_thin.
Fields§
§window: usizeNumber of previous same-type candidates each object is deltified against. Larger windows find better deltas at higher cost.
depth: usizeMaximum delta chain depth. A value of 0 disables deltification.
prefer_ofs_delta: boolWhen true, in-pack deltas are encoded as ofs-deltas (the default and
git’s preference). When false, in-pack deltas use ref-deltas. Deltas
against external thin-pack bases always use ref-deltas regardless.
thin_bases: HashMap<ObjectId, EncodedObject>External base objects, keyed by object id, that are not written into
the pack but may be used as delta bases. Supplying any entries here
produces a thin pack (see PackFile::write_thin). Empty by default,
yielding a self-contained pack.
reorder: boolWhen true (the default), objects are reordered by type and size for
better delta locality. When false, the input order is preserved (the
emitted pack lists objects in the order supplied); deltas then only
reference earlier input objects. Reordering is always skipped when
deltification is disabled (depth == 0), since it has no effect there.
Implementations§
Source§impl PackWriteOptions
impl PackWriteOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Options with git-compatible defaults: window
DEFAULT_PACK_WINDOW, depth DEFAULT_PACK_DEPTH, ofs-deltas, and
no external thin bases.
Sourcepub fn with_window(self, window: usize) -> Self
pub fn with_window(self, window: usize) -> Self
Set the sliding-window size.
Sourcepub fn with_depth(self, depth: usize) -> Self
pub fn with_depth(self, depth: usize) -> Self
Set the maximum delta chain depth (0 disables deltas).
Sourcepub fn with_prefer_ofs_delta(self, prefer_ofs_delta: bool) -> Self
pub fn with_prefer_ofs_delta(self, prefer_ofs_delta: bool) -> Self
Choose whether in-pack deltas use ofs-delta (true) or ref-delta
(false) base references.
Sourcepub fn with_thin_bases(
self,
thin_bases: HashMap<ObjectId, EncodedObject>,
) -> Self
pub fn with_thin_bases( self, thin_bases: HashMap<ObjectId, EncodedObject>, ) -> Self
Provide the set of external base objects permitted for a thin pack.
Sourcepub fn with_reorder(self, reorder: bool) -> Self
pub fn with_reorder(self, reorder: bool) -> Self
Choose whether objects may be reordered for delta locality (true) or
emitted in input order (false).
Trait Implementations§
Source§impl Clone for PackWriteOptions
impl Clone for PackWriteOptions
Source§fn clone(&self) -> PackWriteOptions
fn clone(&self) -> PackWriteOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more