Module Lib_databox.Store_client.KV

A key-value store implementation which fulfills KV_SIG

type t
val create : endpoint:string ‑> Utils.databox_ctx ‑> ?⁠logging:bool ‑> unit ‑> t

create store_uri ctx ?logging () creates a key-value store instance. store_uri could be read from Utils.store_endpoint, ctx could be returned from Utils.databox_init, logging defaults to false.

val register_datasource : t ‑> meta:Store_datasource.meta ‑> unit Lwt.t

register_datasource t ~meta registers a datasource described by meta with store t.

val get_datasource_catalogue : t ‑> string Lwt.t

get_datasource_catalogue t retrieves a summury of all datasources registered with store t.

Store data function

val write : t ‑> datasource_id:string ‑> payload:content ‑> unit Lwt.t

Load data functions

val read : t ‑> datasource_id:string ‑> ?⁠format:content_format ‑> unit ‑> content Lwt.t
val observe : t ‑> datasource_id:string ‑> ?⁠timeout:int ‑> ?⁠format:content_format ‑> unit ‑> content Lwt_stream.t Lwt.t

observe t ~datasource_id ?timeout ?format () returns a stream from which any update on the value associated with datasource_id is returned.

timeout defaults to 0, which means observing until KV_SIG.stop_observing is called, unit is seconds. format defaults to `Json.

val stop_observing : t ‑> datasource_id:string ‑> unit Lwt.t