package irmin

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Parameters

module C : Contents.STORE
module S : STORE with type Val.contents = C.key and module Path = C.Path

Signature

Node Graphs

type t = C.t * S.t

The type for store handles.

type contents = C.key

The type of user-defined contents.

type node = S.key

The type for node values.

type step = S.Path.step

The type of steps. A step is used to pass from one node to another.

type path = S.Path.t

The type of store paths. A path is composed of steps.

val empty : t -> node Lwt.t

The empty node.

val create : t -> (step * [ `Contents of contents | `Node of node ]) list -> node Lwt.t

Create a new node.

val contents : t -> node -> step -> contents option Lwt.t

contents t n s is n's contents in t, associated to the step s.

val succ : t -> node -> step -> node option Lwt.t

succ t n s is n's successors in t, associated to the step s.

val steps : t -> node -> step list Lwt.t

steps t n is the list of steps leaving the node t.

val iter_contents : t -> node -> (step -> contents -> unit) -> unit Lwt.t

iter_contents f fn calls fn on t's contents.

val iter_succ : t -> node -> (step -> node -> unit) -> unit Lwt.t

iter_succ t fn calls fn on t's successors.

Contents

val mem_contents : t -> node -> path -> bool Lwt.t

mem_contents t n path checks if there is a path labeled by path from n to a valid contents in t.

val read_contents : t -> node -> path -> contents option Lwt.t

read_contents t n path is the contents at the end of the path starting from n and labeled by path in t. Return None if no such contents exists.

val read_contents_exn : t -> node -> path -> contents Lwt.t

Same as read_contents but raises Invalid_argument if there is no valid contents.

val add_contents : t -> node -> path -> contents -> node Lwt.t

add_contents t n path c adds the contents c as the end of the path starting from n and labeled by path in t.

val remove_contents : t -> node -> path -> node Lwt.t

remove_contents t n path removes the contents at the end of the path starting from n and labeled by path in t.

Nodes

val mem_node : t -> node -> path -> bool Lwt.t

mem_node t n checks if there is a path labeled by path from n to a valid node in t.

val read_node : t -> node -> path -> node option Lwt.t

read_node t n path is the node at the end of the path starting from n and labeled by path in t. Return None if no such node exists.

val read_node_exn : t -> node -> path -> node Lwt.t

Same as read_node but raise Invalid_argument if the path is invalid.

val add_node : t -> node -> path -> node -> node Lwt.t

add_node t n path c adds the node c as the end of the path starting from n and labeled by path in t.

val remove_node : t -> node -> path -> node Lwt.t

remove_node t n path removes the node at the end of the path of the path starting from n and labeled by path in t.

val closure : t -> min:node list -> max:node list -> node list Lwt.t

closure t ~min ~max is the transitive closure c of t's nodes such that:

  • There is a path in t from any nodes in min to nodes in c. If min is empty, that condition is always true.
  • There is a path in t from any nodes in c to nodes in max. If max is empty, that condition is always false.

B Note: Both min and max are subsets of c.

module Store : Contents.STORE with type t = t and type key = node and type Path.t = path and type Path.step = step

Graph nodes forms a contents store.

OCaml

Innovation. Community. Security.