package git

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type error =
  1. | Invalid_header of string
    (*

    Appear when the header of the IDX file is incorrect.

    *)
  2. | Invalid_version of int32
    (*

    Appear when the version of the IDX file is wrong.

    *)
  3. | Invalid_index
    (*

    Appear when we try to read an area outside the IDX file.

    *)
  4. | Expected_bigoffset_table
    (*

    Appear when we try to read a big offset table and we can't catch it.

    *)
  5. | Invalid_bigoffset_index of int
    (*

    Appear when we try to read a big offset value and we can't catch it.

    *)

The type error.

val pp_error : error Fmt.t

Pretty-printer of error.

type t

State of the IDX lzy decoder.

val make : ?cache:int -> Cstruct.t -> (t, error) result

Make a new state from a Cstruct.t buffer. You can specify how many elements we can store to the cache. This function returns the state t or an error.

Indeed, in this function we check if the IDX file stored entirely on the Cstruct.t is well-formed. Otherwise, we return an explicit error.

val find : t -> Hash.t -> (Checkseum.Crc32.t * int64) option

find t hash get the CRC-32 checksum and the absolute offset binded on hash in the IDX file represented by t only if hash exists. Otherwise, it returns None.

val mem : t -> Hash.t -> bool

mem t hash returns true if hash exists in the IDX file represented by t. Otherwise, it returns false.

val iter : t -> (Hash.t -> (Checkseum.Crc32.t * int64) -> unit) -> unit

Iteration in the IDX file.

val fold : t -> (Hash.t -> (Checkseum.Crc32.t * int64) -> 'a -> 'a) -> 'a -> 'a

Fold in the IDX file.

val cardinal : t -> int
OCaml

Innovation. Community. Security.