Module Conex_io

module Conex_io: sig .. end
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 = {
   basedir : string;
   description : string;
   file_type : Conex_utils.path -> (Conex_utils.file_type, string) Pervasives.result;
   read : Conex_utils.path -> (string, string) Pervasives.result;
   write : Conex_utils.path -> string -> (unit, string) Pervasives.result;
   read_dir : Conex_utils.path -> (Conex_utils.item list, string) Pervasives.result;
   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.
val pp : t Conex_utils.fmt
pp t is a pretty printer for t.

Listings


val ids : t -> (Conex_utils.S.t, string) Pervasives.result
ids t are all ids present on t.
val packages : t -> (Conex_utils.S.t, string) Pervasives.result
packages t are all packages present on t.
val releases : t ->
Conex_resource.name -> (Conex_utils.S.t, string) Pervasives.result
releases t name are all releases of name on t.

Resource computation


type cc_err = [ `FileNotFound of Conex_resource.name
| `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 Conex_io.cc_err.
val compute_release : (string -> Conex_resource.Digest.t) ->
t ->
Conex_utils.Uint.t ->
Conex_resource.name ->
(Conex_resource.Release.t, cc_err) Pervasives.result
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.
val compute_package : t ->
Conex_utils.Uint.t ->
Conex_resource.name -> (Conex_resource.Package.t, string) Pervasives.result
compute_package t create name computes the package by listing all subdirectories of name.

Reading of resource files


type r_err = [ `NameMismatch of
Conex_resource.typ * Conex_resource.name * Conex_resource.name
| `NotFound of Conex_resource.typ * Conex_resource.name
| `ParseError of Conex_resource.typ * Conex_resource.name * string ]
The variant of read and parse errors.
val pp_r_err : r_err Conex_utils.fmt
pp_r_err is a pretty printer for Conex_io.r_err.
val read_id : t ->
Conex_resource.identifier ->
([ `Author of Conex_resource.Author.t | `Team of Conex_resource.Team.t ],
[> r_err ])
Pervasives.result
read_id t id reads and parses the given identifier on t.
val read_author : t ->
Conex_resource.identifier ->
(Conex_resource.Author.t, [> r_err ]) Pervasives.result
read_author t id reads and parses the given author on t.
val read_team : t ->
Conex_resource.identifier ->
(Conex_resource.Team.t, [> r_err ]) Pervasives.result
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 ]) Pervasives.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 ]) Pervasives.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 ]) Pervasives.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) Pervasives.result
write_author t author writes the given author on t.
val write_team : t -> Conex_resource.Team.t -> (unit, string) Pervasives.result
write_team t team writes the given team on t.
val write_authorisation : t ->
Conex_resource.Authorisation.t -> (unit, string) Pervasives.result
write_authorisation t a writes the given authorisation on t.
val write_package : t -> Conex_resource.Package.t -> (unit, string) Pervasives.result
write_package t p writes the given package on t.
val write_release : t -> Conex_resource.Release.t -> (unit, string) Pervasives.result
write_release t r writes the given release on t.