Library
Module
Module type
Parameter
Class
Class type
Create a Irmin store from raw block devices handler. The Irmin process should have full and exclusive access to the block device to ensure atomicity of test_and_set_file
, as it uses in-memory locks.
module D : Git.Hash.DIGEST
module I : Git.Inflate.S
include Git.Store.S
val root : t -> string
The location of the repository root (or any other meaningful name to be displayed to the user). By default, it is the current directory.
val level : t -> int
The compression level
used when creating new Git objects. must be between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). The default value (currently equivalent to level 6) requests a default compromise between speed and compression.
val contents : t -> (Git.Hash.t * Git.Value.t) list Lwt.t
Get the full store contents.
val size : t -> Git.Hash.t -> int option Lwt.t
Return the size of the blob having the given Hash name.
val read : t -> Git.Hash.t -> Git.Value.t option Lwt.t
Return the object having the given Hash name.
val read_exn : t -> Git.Hash.t -> Git.Value.t Lwt.t
Same as read
but raises Not_found
if no object with the given Hash is found.
val mem : t -> Git.Hash.t -> bool Lwt.t
Check whether a key belongs to the store.
val list : t -> Git.Hash.t list Lwt.t
Return the list of Hash names.
val write : t -> Git.Value.t -> Git.Hash.t Lwt.t
Write a value and return the Hash of its serialized contents.
val write_pack : t -> Git.Pack.raw -> Git.Hash.Set.t Lwt.t
Write a raw pack file and the corresponding index. Return the objects IDs which have been written.
val references : t -> Git.Reference.t list Lwt.t
Return the list of references (ie. tags and branches).
val mem_reference : t -> Git.Reference.t -> bool Lwt.t
Check if a reference exists.
val read_reference : t -> Git.Reference.t -> Git.Hash.t option Lwt.t
Read a given reference.
val read_reference_exn : t -> Git.Reference.t -> Git.Hash.t Lwt.t
Read a given reference.
val write_head : t -> Git.Reference.head_contents -> unit Lwt.t
Write the HEAD.
val read_head : t -> Git.Reference.head_contents option Lwt.t
Read the head contents.
val write_reference : t -> Git.Reference.t -> Git.Hash.t -> unit Lwt.t
Write a reference.
val remove_reference : t -> Git.Reference.t -> unit Lwt.t
Remove a reference. Note: packed references cannot be removed (and no error will be raised) so assume that remove_reference
r
is unsafe as it could either delete r
, do nothing, or revert r
to a previous (packed) value.
val test_and_set_reference :
t ->
Git.Reference.t ->
test:Git.Hash.t option ->
set:Git.Hash.t option ->
bool Lwt.t
Atomic updates (Test and set) for references. Note: when set
is None
, test_and_set_reference
should be considered unsafe. See remove_reference
for details.
val read_index : t -> Git.Index.t Lwt.t
Return the index file.
val write_index : t -> ?index:Git.Index.t -> Git.Hash.Commit.t -> unit Lwt.t
Update the index file for the given revision. A side-effect of this operation is that the blobs are expanded into the filesystem.
Note: It is the user responsability to ensure that filenames are valid. No sanitazition is done by the library -- the Git format does not impose a filename format as this is a constraint of the underlying filesystem.
If index
is not set, read the current index and update it with the current state of the filesystem.
val read_inflated : t -> Git.Hash.t -> string option Lwt.t
Read a raw buffer from the store.
val write_inflated : t -> string -> Git.Hash.t Lwt.t
Write a raw buffer in the store.
module Digest : Git.Hash.DIGEST
Digest functions that the store is using.
module Inflate : Git.Inflate.S
Inflate functions that the store is using.
val create_file : t -> string -> Git.Tree.perm -> Git.Blob.t -> unit Lwt.t
Create a file on the filesystem, with the given mode.
val entry_of_file :
t ->
Git.Index.t ->
string ->
Git.Tree.perm ->
Git.Hash.Blob.t ->
Git.Blob.t ->
Git.Index.entry option Lwt.t
Generate a cache entry for the file. Create a fresh file if it does not already exist. If root
is not set, use the current working directory as repository root.