package granary
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11
doc/granary.sample/Granary_sample/Mem_wal/index.html
Module Granary_sample.Mem_walSource
In-memory, byte-addressed WAL device (#403).
Store.open_block_wal expects a WAL accessed by positioned byte I/O at non-sector-aligned offsets, so the WAL cannot ride a page-addressed Mirage_block device directly. This is the shared in-memory backing that both the sample unikernel (mirage/unikernel.ml) and the host smoke test (test/test_mirage_unikernel_smoke.ml) wire into Store.open_block_wal, so the one piece of arch-relevant glue is exercised from a single source.
It is not durable across process runs (the buffer is lost on exit), so a file-backed main DB written with this WAL must be re-created fresh each run.
create ?initial_size () is a fresh zero-filled WAL buffer (initial_size bytes, default 65536). The buffer grows on demand as the WAL is written.
Current buffer size in bytes — pass as ~wal_size_bytes to Store.open_block_wal.
read_at t ~offset buf fills buf from offset; bytes past the written region read back as zero (the WAL grows lazily).
write_at t ~offset src writes src at offset, growing the buffer to cover offset + length src.
No-op flush: an in-memory buffer has nothing to fsync. Pass as ~wal_sync. Db.wal_sync_count still counts the engine's calls to this callback.
Pretty-print the device (its current buffer size).