package granary
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11
doc/granary.unix/Granary_unix/Fault_inject/index.html
Module Granary_unix.Fault_injectSource
Fault-injecting wrapper around Unix_file for crash-recovery tests.
Fault-injecting wrapper around the Unix_file block backend.
Wraps the standard block callbacks; the fail_after_writes counter causes the (N+1)-th write_page call to return Error "injected crash". After failure all subsequent writes also fail (simulating a downed device). Optionally, fail_on_sync forces sync to fail on first invocation.
Recovery correctness (file consistency after a mid-write crash) is NOT in scope for this module — it merely exposes the injection mechanics so that test harnesses can verify the engine does not panic in the face of I/O errors.
Pretty-print a wrapper's write count and fault state.
val open_with_faults :
path:string ->
size_bytes:int ->
config:config ->
(t
* (page_id:int64 ->
Cstruct.t ->
(unit, string) result Lwt.t)
* (page_id:int64 ->
Cstruct.t ->
(unit, string) result Lwt.t)
* (unit ->
(unit, string) result Lwt.t)
* (n_pages:int64 ->
(unit, string) result Lwt.t)
* int64
* (unit ->
unit Lwt.t))
Lwt.tBuild a fault-injecting block backend wrapping a file at path. The file is created if absent and resized to size_bytes bytes. config controls when faults trigger. Returns the wrapper handle along with the callbacks expected by Db.open_block.
The close callback returns unit Lwt.t to match Db.open_block's signature: any error from the underlying Unix_file.close is swallowed (logged-and-discarded) at the wrapper boundary.
Number of successful underlying writes observed by this wrapper.