package ocp-ocamlres

  1. Overview
  2. Docs

Resource store creation and access.

type 'a node =
  1. | Dir of string * 'a node list
  2. | File of string * 'a
  3. | Error of string

A resource: a directory of named sub-resources, a file, or an error token (useful to write more resilient treatments).

type 'a root = 'a node list

A ressource store (a list of toplevel resources)

val merge : 'a root -> 'a root -> 'a root

Merges two resource stores

val find : Path.t -> 'a root -> 'a

Find a resource from its path or raise Not_found.

val find_dir : Path.t -> 'a root -> 'a root

Find a directory (as a root) from its path or raise Not_found.

val add : Path.t -> 'a -> 'a root -> 'a root

Build a new root with an added file.

OCaml

Innovation. Community. Security.