Legend:
Library
Module
Module type
Parameter
Class
Class type
The functor needs 4 modules:
The hash algorithm like SHA1.
A lock implementation to protect references against data-race condition
this module expects a Lwt monad.
An inflate algorithm implementation - usually zlib.
A deflate algorithm implementation - usually zlib.
From the Inflate and the Deflate module, usually, we use a zlib implementation provided by camlzip or decompress. However, you can use an other (better) implementation which needs to respect these interfaces - or provide an implementation which does not inflate/deflate a stream (it's possible). The only non-described by type constraint is the Inflate module needs to understand the Deflate module. For example, use zlib to inflate and brotli to deflate does not work.
compression state returns the current level of the compression used to write a Git object - eg. the default value ?compression value of create if the client does not notice a specific value.
contents state returns an associated list between the hash and its bind git object. This list contains all git objects available in the current git repository state.
val size : t->Hash.t->(int64, error)Stdlib.resultLwt.t
size state hash returns the size of the git object which respects the predicate digest(object) = hash. The size is how many byte(s) are needed to store the serialized (but not deflated) git object in bytes (without the header).
read_exn state hash is an alias of read but raise an exception (instead to return a result) if the git object requested does not exist or when we catch any others errors.
fold state f ~path acc hash iters on any git objects reachable by the git object hash which located in path (for example, if you iter on a commit, path should be "." - however, if you iter on a tree, path should be the directory path represented by your tree). For each git objects, we notice the path name (derived from path) if the object is a Blob or a Tree, the length or the git object (see size), the hash and the value.
If the hash points to:
Value.Blob.t: f is called only one time with the OCaml value of the blob.
Value.Tree.t: f is called firstly with the Ocaml value of the pointed tree by the hash hash. Then, we iter (and call f for each iteration) in the list of entries of the tree. Finally, we retrieve recursively all sub-tree objects and do an ascending walk. f is never called more than one time for each hash.
Value.Commit.t: f is called firstly with the OCaml value of the pointed commit by the hash hash. Then, it follozs recursively all parents of the current commit, Finallym it starts a fold inside the pointed root tree git object of each commit previously retrieved. f never called more than one time for each hash.
Value.Tag.t: f is called firstly with the OCaml value of the pointed tag by the hash hash. Then, it follows the git object pointed by the tag.
read_inflated state hash returns the inflated git object which respect the predicate digest(value) = hash. We return the kind of the object and the inflated value as a Cstruct.t (which the client can take the ownership).
write_inflated state kind raw writes the git object in the git repository state and associates the kind to this object. This function does not verify if the raw data is well-defined (and respects the Git format). Then, this function returns the hash produced from the kind and the inflated raw to let the user to retrieve it.
Backend Features
val has_global_watches : bool
val has_global_checkout : bool
val v :
?dotgit:Fpath.t ->?compression:int ->?buffer:((buffer->unit Lwt.t)->unit Lwt.t)->Fpath.t ->(t, error)Stdlib.resultLwt.t
create ?root ?dotgit ?compression () creates a new store represented by the path root (default is "."), where the Git objects are located in dotgit (default is root / ".git" and when Git objects are compressed by the level (default is 4).