package octez-injector

  1. Overview
  2. Docs

Create an on-disk persistent version of Hashtbl.

Parameters

module H : H

Signature

type key = H.key
type value = H.value
type t

Type of persistent hash tables

val replace : t -> key -> value -> unit Tezos_base.TzPervasives.tzresult Lwt.t

Persistent version of H.replace

Persistent version of H.remove

val find : t -> key -> value option

Same as H.find

val mem : t -> key -> bool

Same as H.mem

val iter_s : (key -> value -> unit Lwt.t) -> t -> unit Lwt.t

Same as H.iter_s

val fold : (key -> value -> 'a -> 'a) -> t -> 'a -> 'a

Same as H.fold

val length : t -> int

Same as H.length

Persistent version of H.replace_seq

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

load_from_disk ~warn_unreadable ~initial_size ~data_dir creates a hash table of size initial_size. The hash table is populated by persistent elements present in data_dir/H.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.