Skip to main content

Module encode

Module encode 

Source
Expand description

Streaming Git pack encoder.

The encoder has two modes:

  • window_size == 0: encode objects independently with zlib. Object compression is parallelized with Rayon and input order is preserved.
  • window_size > 0: group and sort objects, search a sliding window for a suitable delta base, encode the target as an offset delta when profitable, then zlib-compress the payload.

Rabin fingerprinting is the default delta engine. Building without diff_rabin falls back to Myers (diff_mydrs) or Patience when neither diff feature is enabled.

Pack bytes are sent through an async channel instead of being written directly. This keeps object preparation, CPU-heavy compression, and file or network output decoupled. When an index sender is configured, the encoder also records each object’s hash, CRC32, and pack offset so an .idx v2 file can be generated after the pack is complete.

Re-exports§

pub use output::encode_and_output_to_files;

Modules§

output
Top-level convenience: encode entries directly to a .pack / .idx file pair.

Structs§

PackEncoder
Stateful encoder for one Git pack stream.