package index
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=5e0c1f6cbd6e485cbbf2344c8f76de8a7869155355ae6edd5550c88da0661594
sha512=613fa206d1124b34259421f4ea978ce4e9404d78af3a687c1e406d88a5d481bd51465fafae58da9eb3e6a0b5408118b8a7dfe1fbb05ce8fed4b8b0a572beb99b
doc/index.unix/Index_unix/Make/index.html
Module Index_unix.Make
Source
Parameters
module K : Index.Key.S
module V : Index.Value.S
module C : Index.Cache.S
Signature
The type for indexes.
The type for caches of index instances.
val v :
?flush_callback:(unit -> unit) ->
?cache:cache ->
?fresh:bool ->
?readonly:bool ->
?throttle:[ `Overcommit_memory | `Block_writes ] ->
?lru_size:int ->
log_size:int ->
string ->
t
The constructor for indexes.
This can be used to ensure certain pre-conditions are met before bindings are persisted to disk. (For instance, if the index bindings are pointers into another data-structure d
, it may be necessary to flush d
first to avoid creating dangling pointers.)
replace t k v
binds k
to v
in t
, replacing any existing binding of k
.
If overcommit
is true, the operation does not triger a merge, even if the caches are full. By default overcommit
is false.
filter t p
removes all the bindings (k, v) that do not satisfy p
. This operation is costly and blocking.
Iterates over the index bindings. Limitations:
- Order is not specified.
- In case of recent replacements of existing values (since the last merge), this will hit both the new and old bindings.
- May not observe recent concurrent updates to the index by other processes.
Flushes all internal buffers of the IO
instances.
- Passing
~no_callback:()
disables calling theflush_callback
passed tov
. - If
with_fsync
istrue
, this also flushes the OS caches for eachIO
instance.
Closes all resources used by t
, flushing any internal buffers in the instance.
If immediately
is passed, this operation will abort any ongoing background processes. This guarantees not to corrupt the store, but may require additional work to be done on the next startup.
sync t
syncs a read-only index with the files on disk. Raises RW_not_allowed
if called by a read-write index.
is_merging t
returns true if t
is running a merge. Raises RO_not_allowed
if called by a read-only index.
merge t
forces a merge for t
.
If there is no merge running, this operation is non-blocking, i.e. it returns immediately, with the merge running concurrently.
If a merge is running already, this operation blocks until the previous merge is complete. It then launches a merge (which runs concurrently) and returns.
try_merge
is like merge
but is a no-op if the number of entries in the write-ahead log is smaller than log_size
.