package trakeva

  1. Overview
  2. Docs

Implementation of Trakeva_interface.KEY_VALUE_STORE with a dynamically chosen backend among the ones available at compilation time

Implementation of the API

The function create takes a URI string:

  • if the URI scheme is "postgresql" then Trakeva_postgresql will be used,
  • if the URI scheme is "sqlite", or there is no scheme, then Trakeva_sqlite will be used,
  • an exception is raised for other schemes (reserved for future use).
include Trakeva.KEY_VALUE_STORE
type t

The handle to the database.

val load : string -> (t, [> `Database of [> `Load of string ] * string ]) Pvem_lwt_unix.Deferred_result.t

Load a handle from the given database parameters.

val close : t -> (unit, [> `Database of [> `Close ] * string ]) Pvem_lwt_unix.Deferred_result.t

Close the DB.

val get : ?collection:string -> t -> key:string -> (string option, [> `Database of [> `Get of Trakeva.Key_in_collection.t ] * string ]) Pvem_lwt_unix.Deferred_result.t

Get a value in the DB.

val get_all : t -> collection:string -> (string list, [> `Database of [> `Get_all of string ] * string ]) Pvem_lwt_unix.Deferred_result.t

Get all the keys in a given collection as a list.

val iterator : t -> collection:string -> unit -> (string option, [> `Database of [> `Iter of string ] * string ]) Pvem_lwt_unix.Deferred_result.t

Go through all the kets in a given collection (exact semantics versus concurrent writes still to be defined …).

val act : t -> action:Trakeva.Action.t -> ([ `Done | `Not_done ], [> `Database of [> `Act of Trakeva.Action.t ] * string ]) Pvem_lwt_unix.Deferred_result.t

Process a transaction, which can be `Done is successful or `Not_done if one of the checks in the Action.t failed.

val available_backends : string list

The databases that are available via create

OCaml

Innovation. Community. Security.