Functor Ezirmin.Memory_queue

module Memory_queue: 
functor (V : Tc.S0) -> Queue with type elt = V.t
A Queue that uses the git in-memory backend.
Parameters:
V : Tc.S0


Mergeable Queue



Queue provides double-ended queue with automatic merges.
include Ezirmin.Repo
type elt 
The type of element in the queue.
val create : ?message:string -> branch -> path:string list -> unit Lwt.t
Create a new queue. If a queue already exists at this path, then this operation overwrites the old queue.
val length : branch -> path:string list -> int Lwt.t
Return the length of the queue. If the queue does not exist, then 0 is returned.
val is_empty : branch -> path:string list -> bool Lwt.t
Returns true if the queue is empty. If the queue does not exist, then return true.
val push : ?message:string ->
branch -> path:string list -> elt -> unit Lwt.t
push m b p e pushes element e to the back of the queue at path p in branch b with commit message m. If the queue does not exist at this path, then an empty queue is created and e is pushed to the back of this queue.
val pop_exn : ?message:string -> branch -> path:string list -> elt Lwt.t
Pop an element from the front of the queue. If the queue is empty or does not exist at this path, then exception Empty is raised.
val pop : ?message:string ->
branch -> path:string list -> elt option Lwt.t
Pop an element from the front of the queue. If the queue is empty of does not exist at this path, then None is returned.
val to_list : branch -> path:string list -> elt list Lwt.t
Return a list with the elements in the queue.

Iteration


type cursor 
The type of cursor.
val get_cursor : branch -> path:string list -> cursor option Lwt.t
Return the cursor that points to the head of the queue. If the queue does not exist, return None.
val next_exn : cursor -> (elt * cursor) Lwt.t
Get the next element in the queue. Return a pair of the head element and a cursor that points to the tail of the queue. Raise Empty if the cursor points to an empty queue.
val next : cursor ->
(elt * cursor) option Lwt.t
Get the next element in the queue. Return a pair of the head element and a cursor that points to the tail of the queue. Return None if the cursor points to an empty queue.
val iter : branch -> path:string list -> f:(elt -> unit) -> unit Lwt.t
iter b p f applies f on each element of the queue from the front to the back of the queue.

Watch


val watch : branch ->
path:string list -> (unit -> unit Lwt.t) -> (unit -> unit Lwt.t) Lwt.t
watch b p cb watches the queue at path p in branch b, and invokes the callback function if there are any updates.
Returns a function to disable the watch.