package granary
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11
doc/granary.unix/Granary_unix/Unix_file/index.html
Module Granary_unix.Unix_fileSource
Unix-file BLOCK backend (pread/pwrite over a Unix fd).
Unix file-backed BLOCK implementation. Opens or creates a file. Takes an OS-level flock(LOCK_EX) on open to prevent concurrent access from two processes.
Pretty-print the file's page count.
Pretty-print an error.
set_page_size t ps adopts page size ps for addressing and recomputes the logical page count from the file's byte size (#95). Called by the open path after peeking the header's geometry on an existing file.
open_ ?page_size ~path () opens (or creates) the file and takes an exclusive flock. page_size (default 4096, #95) sets the addressing granularity; for an existing file of a different geometry, open at the default then set_page_size after peeking the header.
Release the lock and close the underlying file descriptor.
read_page t ~page_id buf reads page page_id into buf.
write_page t ~page_id buf writes buf to page page_id.
fsync the underlying file, durably persisting prior writes.