plebeia
-
plebeia
-
-
plebeia.msync
-
plebeia.test_utils
-
Library
Module
Module type
Parameter
Class
Class type
type entry = {
parent : Commit_hash.t option; | |
index : Index.t; | (* The index in the context for Commit.t *) |
}
Create a new empty commit tree file
val open_ :
?resize_step_bytes:int ->
mode:Storage.mode ->
string ->
t option Lwt.t
If the file exists, load its latest commit tree. Otherwise, returns None
gc fn
replaces the commit tree file fn
by a new one only with the latest commit found in fn
.
The original file is backed up as fn ^ ".old"
. If the backup file already exists, it is overwritten.
This GC is offline. Never call this function when fn
is being used.
Update t
to the latest commit tree on the disk.
The reader process of the commit tree must call this function time to time to get the updates by the writer.
Forget the on-memory cache of t
. This fails and returns None
if t
has unsaved updates.
Close t
.
In Writer mode, it saves before closing. Save errors do not prevent the closing.
val mode : t -> Storage.mode
val mem : t -> Commit_hash.t -> bool
val find : t -> Commit_hash.t -> entry option
val add : t -> Commit_hash.t -> entry -> t
If a binding already exists, it is overwritten.
val fold : ( Commit_hash.t -> entry -> 'a -> 'a Lwt.t ) -> t -> 'a -> 'a Lwt.t
val iter : ( Commit_hash.t -> entry -> unit Lwt.t ) -> t -> unit Lwt.t
val children : t -> ( Commit_hash.t -> (Commit_hash.t * entry) list ) Lwt.t
children t
returns a function to query children of the given hash.
Note that children t
takes some time since it traverses the whole commit tree.
val geneses : t -> (Commit_hash.t * entry) list Lwt.t
Get the genesis commit hashes and the entries, which have no parent.
This function traverses the whole commit tree, therefore inefficient.
val ordered_fold :
( Commit_hash.t ->
entry ->
children:(Commit_hash.t * entry) list ->
'a ->
'a Lwt.t ) ->
t ->
'a ->
'a Lwt.t
Folding. Parent commits are folded earlier than their children
Note that ordered_fold
takes some time since it traverse the whole commit tree.
module Internal : sig ... end
test and debugging purpose