package octez-injector

  1. Overview
  2. Docs

Create an on-disk persistent version of the Hash_queue data structure.

Parameters

module N : sig ... end
module V : sig ... end

Signature

type t

remove 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 Tezos_base.TzPervasives.tzresult Lwt.t

replace 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.

val fold : (K.t -> V.t -> 'a -> 'a) -> t -> 'a -> 'a

fold f q init folds the function f over the bindings of q (in memory). The elements are iterated from oldest to newest.

val find_opt : t -> K.t -> V.t option

find_opt q k is Some v if k is bound to v in q. It is None otherwise.

val length : t -> int

length q is the number of bindings held by q.

val load_from_disk : warn_unreadable: (string -> Tezos_base.TzPervasives.error Tezos_base.TzPervasives.trace -> unit Lwt.t) option -> capacity:int -> data_dir:string -> filter:(V.t -> bool) -> t Tezos_base.TzPervasives.tzresult Lwt.t

load_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.

OCaml

Innovation. Community. Security.