package git-unix

  1. Overview
  2. Docs
type t = {
  1. mutable delta : delta;
}

The type of the delta-ification.

and delta =
  1. | Z
    (*

    Means no delta-ification.

    *)
  2. | S of {
    1. length : int;
      (*

      Length of the PACK object.

      *)
    2. depth : int;
      (*

      Depth of the PACK object.

      *)
    3. hunks : Duff.t list;
      (*

      Compression list.

      *)
    4. src : t;
      (*

      Source.

      *)
    5. src_length : int64;
      (*

      Length of the source object.

      *)
    6. src_hash : Hash.t;
      (*

      Hash of the source object.

      *)
    }
    (*

    Delta-ification with a description of the source.

    *)
type error =
  1. | Invalid_hash of Hash.t
    (*

    Appears when we have an invalid hash.

    *)

The type of error.

val pp_error : error Fmt.t

Pretty-printer for error.

val deltas : ?memory:bool -> Entry.t list -> (Hash.t -> Cstruct.t option Lwt.t) -> (Entry.t -> bool) -> int -> int -> ((Entry.t * t) list, error) Stdlib.result Lwt.t

deltas ?memory lst getter tagger window depth.

This is the main algorithm about the serialization of the git object in a PACK file. The purpose is to order and delta-ify entries.

getter is a function to access to the real inflated raw of the git object requested by the hash. This function must allocate the raw (or let the ownership to this function). The algorithm takes the ownership anyway.

tagger is a function to annotate an entry as preferred to serialize firstly.

window corresponds to the number of how many object(s) we keep for the delta-ification or, if memory is true, how many byte(s) we keep for the delta-ification. The client can control the memory consumption of this algorithm precisely if he wants.

depth is the maximum of the delta-ification allowed.

If you want to understand the algorithm, look the source code.

OCaml

Innovation. Community. Security.