package conex

  1. Overview
  2. Docs

IO operations

Conex relies on providers to read data from and write data to. Each access consists of a Path used as key. Only basic file types are supported (no symbolic links).

IO provider

type t = {
  1. basedir : string;
  2. description : string;
  3. file_type : Conex_utils.path -> (Conex_utils.file_type, string) result;
  4. read : Conex_utils.path -> (string, string) result;
  5. write : Conex_utils.path -> string -> (unit, string) result;
  6. read_dir : Conex_utils.path -> (Conex_utils.item list, string) result;
  7. exists : Conex_utils.path -> bool;
}

A provider contains its base directory, a description, and read/write/exist functionality. TODO: define this as a module type.

pp t is a pretty printer for t.

Listings

val ids : t -> (Conex_utils.S.t, string) result

ids t are all ids present on t.

val packages : t -> (Conex_utils.S.t, string) result

packages t are all packages present on t.

val releases : t -> Conex_resource.name -> (Conex_utils.S.t, string) result

releases t name are all releases of name on t.

Resource computation

type cc_err = [
  1. | `FileNotFound of Conex_resource.name
  2. | `NotADirectory of Conex_resource.name
]

The variant of errors when computing checksums

val pp_cc_err : cc_err Conex_utils.fmt

pp_cc_err is a pretty printer for cc_err.

compute_release digestf t now name computes the release by computing checksums of all files and directories of name using digestf. If release name is not found, an error is signalled.

compute_package t create name computes the package by listing all subdirectories of name.

Reading of resource files

type r_err = [
  1. | `NotFound of Conex_resource.typ * Conex_resource.name
  2. | `ParseError of Conex_resource.typ * Conex_resource.name * string
  3. | `NameMismatch of Conex_resource.typ * Conex_resource.name * Conex_resource.name
]

The variant of read and parse errors.

val pp_r_err : r_err Conex_utils.fmt

pp_r_err is a pretty printer for r_err.

val read_id : t -> Conex_resource.identifier -> ([ `Author of Conex_resource.Author.t | `Team of Conex_resource.Team.t ], [> r_err ]) result

read_id t id reads and parses the given identifier on t.

read_author t id reads and parses the given author on t.

read_team t id reads and parses the given team on t.

val read_authorisation : t -> Conex_resource.name -> (Conex_resource.Authorisation.t, [> r_err ]) result

read_authorisation t name reads and parses the authorisation for the given name on t.

val read_package : t -> Conex_resource.name -> (Conex_resource.Package.t, [> r_err ]) result

read_package t name reads and parses the package for the given name on t.

val read_release : t -> Conex_resource.name -> (Conex_resource.Release.t, [> r_err ]) result

read_release t name.version reads and parses the release for the given name.version on t.

Writing of resources to files

val write_author : t -> Conex_resource.Author.t -> (unit, string) result

write_author t author writes the given author on t.

val write_team : t -> Conex_resource.Team.t -> (unit, string) result

write_team t team writes the given team on t.

val write_authorisation : t -> Conex_resource.Authorisation.t -> (unit, string) result

write_authorisation t a writes the given authorisation on t.

val write_package : t -> Conex_resource.Package.t -> (unit, string) result

write_package t p writes the given package on t.

val write_release : t -> Conex_resource.Release.t -> (unit, string) result

write_release t r writes the given release on t.