package conex
Module Conex_ioSource
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) result;read : Conex_utils.path -> (string, string) result;write : Conex_utils.path -> string -> (unit, string) result;read_dir : Conex_utils.path -> (Conex_utils.item list, string) 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.
pp t is a pretty printer for t.
Listings
ids t are all ids present on t.
packages t are all packages present on t.
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
pp_cc_err is a pretty printer for cc_err.
val compute_release :
(string -> Conex_resource.Digest.t) ->
t ->
Conex_utils.Uint.t ->
Conex_resource.name ->
(Conex_resource.Release.t, cc_err) resultcompute_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) resultcompute_package t create name computes the package by listing all subdirectories of name.
Reading of resource files
type r_err = [ | `NotFound of Conex_resource.typ * Conex_resource.name| `ParseError of Conex_resource.typ * Conex_resource.name * string| `NameMismatch of Conex_resource.typ * Conex_resource.name * Conex_resource.name
]The variant of read and parse errors.
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 ])
resultread_id t id reads and parses the given identifier on t.
val read_author :
t ->
Conex_resource.identifier ->
(Conex_resource.Author.t, [> r_err ]) resultread_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 ]) resultread_authorisation t name reads and parses the authorisation for the given name on t.
read_package t name reads and parses the package for the given name on t.
read_release t name.version reads and parses the release for the given name.version on t.
Writing of resources to files
write_author t author writes the given author on t.
write_team t team writes the given team on t.
write_authorisation t a writes the given authorisation on t.
write_package t p writes the given package on t.
write_release t r writes the given release on t.