type t = RPDec.Object.t
The type of the packed Git object.
type state = t
The type for the state of a Git store.
type value = Value.t
The type of the Git values.
module Deflate : sig ... end
The Deflate
module used to make the implementation.
module IDec : Git.Index_pack.LAZY with module Hash := Hash
module IEnc : Git.Index_pack.ENCODER with module Hash := Hash
module PInfo : Git.Pack_info.S with module Hash := Hash and module Inflate := Inflate and module HDec := HDec and module PDec := PDec
type error = error
val lookup : state -> Hash.t -> (Hash.t * (Checkseum.Crc32.t * int64)) option Lwt.t
lookup state hash
tries to find the object associated by the hash hash
in all IDX files available in the current git repository state
. This function returns None
if the Git object does not exist in any IDX files or it does not exists in the current repository.
mem state hash
is true iff there is an object such that digest(object)
= hash
. This function is the same as lookup state hash <> None
.
list state
is the list of all the packed Git object noticed by all IDX files available in the current git repository state
. Errors are ignored and skipped.
read state hash
can retrieve a git packed object from any PACK files available in the current git repository state
. It just inflates the git object and informs some meta-data (like kind, CRC-32 check-sum, length, etc.) about it. Then, the client can use the related decoder to get the OCaml value.
This function allocates 2 Cstruct.t
needed to re-construct the git packed object in any case (if it is delta-ified or not) and a certain amount of little buffer (sized by 0x7F bytes) to help the construction only when the requested object is delta-ified.
Can return an error
:
FS
.File.error orFS
.Dir.error orFS
.Mapper.error when we retrieve a file-system errorPACKDecoder
.error when we retrieve an error about the decoding of the packed git object in the founded PACKi fileIDXDecoder
.error when we retrieve an error about the decoding of an IDX file`Not_found
when the requested object is not packed
val size : state -> Hash.t -> (int, error) Stdlib.result Lwt.t
from git stream
populates the Git repository git
from the PACK flow stream
. If any error is encountered, any Git objects of the PACK flow are not added in the Git repository.
val make : state -> ?window:[ `Object of int | `Memory of int ] -> ?depth:int -> value list -> (stream * (Checkseum.Crc32.t * int64) Hash.Map.t Lwt_mvar.t, error) Stdlib.result Lwt.t
make ?window ?depth values
makes a PACK stream from a list of Value.t
.
?window
specifies the weight of the window while the delta-ification. The client can limit the weight by the number of objects in the windoz (by default, is 10) or by the weight in byte of the window in your memory.
depth
(default is 50
) limits the depth of the delta-ification.
Then, the function returns a stream and a protected variable which contains a representation of the associated IDX file of the PACK stream. This protected variable is available (Lwt_mvar.take
) only at the end of the PACK stream. That means, the client needs to consume all of the stream and only then he can take the Graph.t
associated.