package irmin

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

Node provides a simple node implementation, parameterized by the contents C, node N and paths P.

Parameters

module C : Tc.S0
module N : Tc.S0
module P : Path.S

Signature

Node values

include Tc.S0
type t
val equal : t Tc.equal
val compare : t Tc.compare
val hash : t Tc.hash
val to_json : t Tc.to_json

The REST inteface.

val of_json : t Tc.of_json
val size_of : t Tc.size_of

The serialization format.

val write : t Tc.writer
val read : t Tc.reader
type contents = C.t

The type for contents keys.

type node = N.t

The type for node keys.

type step = P.step

The type for steps between nodes.

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

create l is a new node.

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

alist t is the contents of t.

val empty : t

The empty node.

val is_empty : t -> bool

Is the node empty?

val contents : t -> step -> contents option

Get the node contents.

A node can point to user-defined contents. The edge between the node and the contents is labeled by a step.

val iter_contents : t -> (step -> contents -> unit) -> unit

iter_contents t f calls f on t's contents. For better performance, use contents instead when you know the step in advance.

val with_contents : t -> step -> contents option -> t

with_contents t s c replaces t's contents for the step s by c.

val succ : t -> step -> node option

succ t s is s's successor in t.

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

iter_succ t f calls f on t's successors.

val with_succ : t -> step -> node option -> t

replace_succ t s n replaces t's successor for the step s by n.

OCaml

Innovation. Community. Security.