Log_file.Make
module Value : Data.Value
type key := Key.t
type value := Value.t
create io
constructs a write-ahead log from an IO handle referencing an unordered sequence of (binary encoded) key * value
bindings. The bindings are read into memory, and any subsequent replace
operations are reflected on disk.
val close : t -> unit
val cardinal : t -> int
to_sorted_seq t
is the sequence of all entries in t
, sorted by Entry.compare
. Modifying t
while consuming the sequence results in undefined behaviour.
io t
is t
's underlying IO handle. Any updates to the file will not be reflected in the in-memory mirror of its state.
val sync_entries : min:Import.int63 -> t -> unit
sync_entries ~min t
loads the entries from log
's IO into memory, starting from offset min
.
val flush : ?no_callback:unit -> with_fsync:bool -> t -> unit
flush t
is IO.flush (io t)
.
val reload : t -> unit
reload t
clears t
's in-memory state and reloads all bindings from the underlying IO hande.
val clear :
generation:Import.int63 ->
?hook:(unit -> unit) ->
reopen:bool ->
t ->
unit
clear t
clears both t
's in-memory state and its underlying IO handle. The flags are passed to IO.clear
.