package index
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=6051cf8cad4ab425d8501063110c1fc91fb86fa90426b094dce34cdea5588a91
sha512=8fda03c25fef27d6744dd3aabc5928184cd62f32d0ab80c7b819b07f046988c83cd70527b87ec44d537d4650ea8b1fb949dc10b2e2acf66def219a4bcf3da022
doc/index.unix/Index_unix/Private/Make/index.html
Module Private.MakeSource
Parameters
module K : Index.Key.Smodule V : Index.Value.Smodule C : Index.Cache.SSignature
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 ] ->
log_size:int ->
string ->
tThe 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_callbackpassed tov. - If
with_fsyncistrue, this also flushes the OS caches for eachIOinstance.
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.
Offline fsck-like utility for checking the integrity of Index stores built using this module.
Some operations that trigger a merge can have hooks inserted at the following stages:
`Before: immediately before merging (while holding the merge lock);`After_clear: immediately after clearing the log, at the end of a merge;`After_first_entry: immediately after adding the first entry in the merge file, if the data file contains at least one entry;`After: immediately after merging (while holding the merge lock).
The type of asynchronous computation.
val replace' :
?hook:[ `Merge of merge_stages ] Index.Private.Hook.t ->
?overcommit:bool ->
t ->
key ->
value ->
merge_result async optionreplace' t k v is like replacetkv but returns a promise of a merge result if the replace call triggered one.
`Abort_signalled: after the cancellation signal has been sent to any concurrent merge operations, but before blocking on those cancellations having completed.
val try_merge_aux :
?hook:merge_stages Index.Private.Hook.t ->
?force:bool ->
t ->
merge_result asynctry_merge_aux t tries to merge t. If force is false (the default), a merge is performed only if there is more entries in the write-ahead log than the configured limits. If force is set, the merge is performed no matter what.
Wait for an asynchronous computation to finish.
Time replace operations. The reported time is an average on an number of consecutive operations, which can be specified by sampling_interval. If sampling_interval is not set, no operation is timed.
val sync' :
?hook:
[ `Before_offset_read
| `After_offset_read
| `Reload_log
| `Reload_log_async ]
Index.Private.Hook.t ->
t ->
unitHooks:
`Before_offset_read: before reading the generation number and the offset.`After_offset_read: after reading the generation number and offset.