Granary_unix.Unix_fileSourceUnix-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.