Disk_persistence.Make_queueCreate an on-disk persistent version of the Hash_queue data structure.
module N : sig ... endmodule K : Mavryk_crypto.Intfs.HASHmodule V : sig ... endval remove : t -> K.t -> unit Mavryk_base.TzPervasives.tzresult Lwt.tremove q k removes the binding from k in q. If k is not bound in c, it does nothing. The removal is persisted on disk.
val replace : t -> K.t -> V.t -> unit Mavryk_base.TzPervasives.tzresult Lwt.treplace q k v binds the key k to the value v in the queue q. This may or may not cause another binding to be removed, depending on the number of bindings already present in q. The addition (or replacement) is persisted on disk.
fold f q init folds the function f over the bindings of q (in memory). The elements are iterated from oldest to newest.
find_opt q k is Some v if k is bound to v in q. It is None otherwise.
val length : t -> intlength q is the number of bindings held by q.
val clear : t -> unit Lwt.tclear q empties the queue q and removes its persistent content on disk.
val load_from_disk :
warn_unreadable:
(string ->
Mavryk_base.TzPervasives.error Mavryk_base.TzPervasives.trace ->
unit Lwt.t)
option ->
capacity:int ->
data_dir:string ->
filter:(V.t -> bool) ->
t Mavryk_base.TzPervasives.tzresult Lwt.tload_from_disk ~warn_unreadable ~capacity ~data_dir ~filter creates a bounded hash queue of capacity capacity. The queue is populated by persistent elements present in data_dir/N.name which pass the filter (the directory is created if it does not exist). If warn_unreadable is Some warn, unreadable files are ignored but a warning is printed with warn, otherwise the loading fails on the first unreadable file.