package albatross

  1. Overview
  2. Docs

A trie data structure where Vmm_core.Name.t elements are the edges, and 'a option is at each nodes.

Since policies are modeled as X.509 arcs, or paths, or domain names - we often need a data structure to access all nodes at the same level (and ensure there's at most one thing at each level.

type 'a t

The type of a Vmm_trie.

val empty : 'a t

empty is the empty trie.

val insert : Vmm_core.Name.t -> 'a -> 'a t -> 'a t * 'a option

insert name v t returns the new t', where t'(name) = Some v (this is the only modification). Also, potentially t(name) is returned, if it was present.

val remove : Vmm_core.Name.t -> 'a t -> 'a t

remove name t removes the value t(name), and returns the new t'.

val find : Vmm_core.Name.t -> 'a t -> 'a option

find name t returns the value t(name), if present.

val collect : Vmm_core.Name.t -> 'a t -> (Vmm_core.Name.t * 'a) list

collect name t finds for each sub-element of name the connected values. If name is "foo:bar", ("foo:bar", t("foo:bar")) :: ("foo", t("foo")) :: ("", t("")) :: [] are returned (only the values present are returned.

This is at the moment used in the albatross statistics daemon, but it may be removed soon.

val all : 'a t -> (Vmm_core.Name.t * 'a) list

all t flattens the trie into an associative list.

val fold : Vmm_core.Name.path -> 'a t -> (Vmm_core.Name.t -> 'a -> 'b -> 'b) -> 'b -> 'b

fold path t f init folds f over t at path. Each subnode of path is passed to f.

OCaml

Innovation. Community. Security.