123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110(*
* Copyright (c) 2013-2022 Thomas Gazagnaire <thomas@gazagnaire.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)openStore_propertiestype'adiff='aDiff.tmoduletypeS=sig(** {1 Atomic write stores}
Atomic-write stores are stores where it is possible to read, update and
remove elements, with atomically guarantees. *)typet(** The type for atomic-write backend stores. *)includeRead_only.Swithtype_t:=t(** @inline *)valset:t->key->value->unitLwt.t(** [set t k v] replaces the contents of [k] by [v] in [t]. If [k] is not
already defined in [t], create a fresh binding. Raise [Invalid_argument]
if [k] is the {{!Irmin.Path.S.empty} empty path}. *)valtest_and_set:t->key->test:valueoption->set:valueoption->boolLwt.t(** [test_and_set t key ~test ~set] sets [key] to [set] only if the current
value of [key] is [test] and in that case returns [true]. If the current
value of [key] is different, it returns [false]. [None] means that the
value does not have to exist or is removed.
{b Note:} The operation is guaranteed to be atomic. *)valremove:t->key->unitLwt.t(** [remove t k] remove the key [k] in [t]. *)vallist:t->keylistLwt.t(** [list t] it the list of keys in [t]. *)typewatch(** The type of watch handlers. *)valwatch:t->?init:(key*value)list->(key->valuediff->unitLwt.t)->watchLwt.t(** [watch t ?init f] adds [f] to the list of [t]'s watch handlers and returns
the watch handler to be used with {!unwatch}. [init] is the optional
initial values. It is more efficient to use {!watch_key} to watch only a
single given key.*)valwatch_key:t->key->?init:value->(valuediff->unitLwt.t)->watchLwt.t(** [watch_key t k ?init f] adds [f] to the list of [t]'s watch handlers for
the key [k] and returns the watch handler to be used with {!unwatch}.
[init] is the optional initial value of the key. *)valunwatch:t->watch->unitLwt.t(** [unwatch t w] removes [w] from [t]'s watch handlers. *)includeClearablewithtype_t:=t(** @inline *)includeCloseablewithtype_t:=t(** @inline *)endmoduletypeMaker=functor(K:Type.S)(V:Type.S)->sigincludeSwithtypekey=K.tandtypevalue=V.tincludeOf_configwithtype_t:=t(** @inline *)endmoduletypeSigs=sigmoduletypeS=SmoduletypeMaker=MakermoduleCheck_closed_store(AW:S):sigincludeSwithtypekey=AW.keyandtypevalue=AW.valueandtypewatch=AW.watchvalmake_closeable:AW.t->t(** [make_closeable t] returns a version of [t] that raises {!Irmin.Closed}
if an operation is performed when it is already closed. *)valget_if_open_exn:t->AW.t(** [get_if_open_exn t] returns the store (without close checks) if it is
open; otherwise raises {!Irmin.Closed} *)endmoduleCheck_closed(M:Maker):Makerend