package git

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Entry : Pack.ENTRY with module Hash := Hash
module Delta : Pack.DELTA with module Hash := Hash and module Entry := Entry
module Hunk : Pack.H with module Hash := Hash

The Map tree zhich zill represent the IDX file of the PACK stream.

type error =
  1. | Deflate_error of Deflate.error
    (*

    Appears when the deflate algorithm raises an error.

    *)
  2. | Invalid_hash of Hash.t
    (*

    Appears when the hash requested does not exist.

    *)

The type error.

val pp_error : error Fmt.t

Pretty-printer for error.

type t

The type of the encoder.

val used_out : t -> int

used_out ŧ returns how many byte t wrote in the current buffer noticed to the previous call of eval.

val used_in : t -> int

used_in ŧ returns how many byte t consumed in the current buffer noticed to the previous call of eval.

val flush : int -> int -> t -> t

flush off len t provides t with len bytes to write, starting at off. This byte range is written by calls to eval with t until `Flush is returned.

val refill : int -> int -> t -> t

refill off len t provides a new t with len bytes to read, starting at off. This byte range is read by calls to eval with t until `Await is returned. The client should fill by the expect git object.

val finish : t -> t

finish t provides a new t which terminate to serialize the current Git object. The next call of eval should not return an `Await value unless the output space is enough to start to serialize the next entry.

val expect : t -> Hash.t

expect t returns the object expected to the serialization. At this time, the serializer requests the inflated raw of this git object. The client is able to use it only when eval return `Await. The encoder does not wqnt the ownership of the inflated raw, it access on it only as a read-only flow (that means, the src Cstruct.t could be physicaly the same.

val idx : t -> (Checkseum.Crc32.t * int64) Hash.Map.t

idx t returns a Map tree which contains the CRC-32 checksum and the absolute offset for each Git object serialized. The client is able to use it only when eval returns `End.

val default : Cstruct.t -> (Entry.t * Delta.t) list -> t

Make a new encoder t of the PACK stream.

tmp is a Cstruct.t used as an internal output of the Hunk Encoder H. We let the user to allocate the optimized length for this temporary buffer and we take the ownership (so, you don't use it to another computer).

Then, the client need to notice the ordered list of what he wants to serialize.

val eval : Cstruct.t -> Cstruct.t -> t -> [ `Flush of t | `Await of t | `End of t * Hash.t | `Error of t * error ]

eval src t is:

  • `Await t iff t needs more input storage. The client must use refill to provide a new buffer and then call eval with `Await until other value returned.
  • `Flush t iff t needs more output storage. The client must use flush to provide a new buffer and then call eval with `Flush until other value returned.
  • `End (t, hash) when t is done. Then, t sticks on this situation, the client can remove it. hash is the hash calculated of the PACK stream.
  • `Error (t, exn) iff the encoder t meet an error exn. The encoder can't continue and sticks in this situation.