Disk_persistence.Make_table
Create an on-disk persistent version of Hashtbl
.
type key = H.key
type value = H.value
val replace : t -> key -> value -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
Persistent version of H.replace
val remove : t -> key -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
Persistent version of H.remove
val iter_es :
(key -> value -> unit Mavryk_base.TzPervasives.tzresult Lwt.t) ->
t ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
Same as H.iter_es
val replace_seq :
t ->
(key * value) Mavryk_base.TzPervasives.Seq.t ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
Persistent version of H.replace_seq
val load_from_disk :
warn_unreadable:
(string ->
Mavryk_base.TzPervasives.error Mavryk_base.TzPervasives.trace ->
unit Lwt.t)
option ->
initial_size:int ->
data_dir:string ->
filter:(value -> bool) ->
t Mavryk_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.