plebeia

Functional storage using Merkle Patricia tree
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library plebeia
Module Plebeia . Fs_tree . Make . Op_lwt
type 'a t = tree -> ( tree * 'a, Error.t ) Stdlib.result Lwt.t

Monad for asynchronous file system operations

include Monad.S1 with type 'a t := 'a t
val return : 'a -> 'a t
val bind : 'a t -> ( 'a -> 'b t ) -> 'b t
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapM : ( 'a -> 'b t ) -> 'a list -> 'b list t
val mapM_ : ( 'a -> unit t ) -> 'a list -> unit t
val iterM : ( 'a -> unit t ) -> 'a list -> unit t

alias of mapM_

val fold_leftM : ( 'a -> 'b -> 'a t ) -> 'a -> 'b list -> 'a t
val parseM : ( 'a -> 'b list -> ('a * 'b list) t ) -> 'a -> 'b list -> 'a t
module Infix : sig ... end
module Syntax : sig ... end
val lift : 'a Op.t -> 'a t

Convert Op monad to Op_lwt

val lift_op : 'a Op.t -> 'a t
val lift_lwt : 'a Lwt.t -> 'a t

Monad lifters

val lift_result : ( 'a, Error.t ) Stdlib.result -> 'a t
val lift_result_lwt : ( 'a, Error.t ) Stdlib.result Lwt.t -> 'a t
val fail : error -> 'a t

Lifted versions of Op functions

val raw_cursor : raw_cursor t
val copy : Path.t -> Path.t -> unit t
val cat : Path.t -> Value.t t
val write : Path.t -> Value.t -> unit t
val rm : ?recursive:bool -> ?ignore_error:bool -> Path.t -> bool t
val rmdir : ?ignore_error:bool -> Path.t -> bool t
val compute_hash : Path.t -> hash t
val may_forget : Path.t -> unit t
val get_tree : Path.t -> (tree * view) t
val set_tree : Path.t -> tree -> unit t
val cursor : cursor t
val do_then : ( tree -> unit ) -> 'a t -> 'a t
val fold : 'a -> Path.t -> ( 'a -> Path.t -> tree -> ( [ `Continue | `Exit | `Up ] * 'a, Error.t ) Stdlib.result Lwt.t ) -> 'a t

Folding

  • `Continue: if the item is a directory, its items are recursively folded
  • `Up: if the item is a directory, its items are skipped
  • `Exit: terminate the folding immediately and returns the accumulator as the final result of fold
val fold' : ?depth:[ `Eq of int | `Ge of int | `Gt of int | `Le of int | `Lt of int ] -> 'a -> Path.t -> ( 'a -> Path.t -> tree -> ( 'a, Error.t ) Stdlib.result Lwt.t ) -> 'a t

Folding with a depth specification

val ls : Path.t -> (name * tree) list t

List the directory specified by the path

val run : tree -> 'a t -> ( tree * 'a, Error.t ) Stdlib.result Lwt.t

Monad runner