package git-unix

  1. Overview
  2. Docs
type error

The type error. We can't have an error to serialize an IDX file - it's just to homogenize interfaces each others.

val pp_error : error Fmt.t

Pretty-printer of error.

type t

The encoder state.

val pp : t Fmt.t

Pretty-printer of the encoder t.

type 'a sequence = ('a -> unit) -> unit

An abstract representation of an iterative container.

val default : (Hash.t * (Checkseum.Crc32.t * int64)) sequence -> Hash.t -> t

default seq pack_hash makes a new encoder to serialize seq and associates the IDX stream produced with the pack_hash PACK file. This function takes care about the order of seq, so the client does not need to sort the iterative container.

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. Use used_out to know how many byte t wrote.

val used_out : t -> int

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

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

eval dst t is:

  • `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 `End is returned.
  • `End t when the encoder is done. t sticks to this situation. The client can remove it.
  • `Error (t, exn) iff the encoder meet an error exn. The encoder can't continue and sticks in this situation.
OCaml

Innovation. Community. Security.