package granary
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11
doc/granary.storage/Granary_storage/Geometry/index.html
Module Granary_storage.GeometrySource
Page geometry (#95): the per-file choice of page_size and reserved_bytes_per_page, fixed at file creation and persisted in the header. Addressing is offset = page_id * page_size, so the size is uniform across a file and immutable once chosen.
This is a cheap, pure value carried on the pager/store context; the derived sizes below are plain field arithmetic, safe to call on every page op.
type t = {page_size : int;(*total bytes per page on disk; a multiple of 4096
*)reserved_bytes_per_page : int;(*fixed bytes carved off the END of every page (default 0); subtractive overhead reserved for future fixed-size per-page metadata such as a per-page AEAD tag for at-rest encryption (#84). Does not enable page-level compression.
*)
}Pretty-print a geometry as { page_size = ...; reserved_bytes_per_page = ... }.
16 — the common page header, excluded from usable payload.
12 — bytes per freelist entry.
The historical fixed geometry: 4096-byte page, no reserved bytes. Used as the default at creation and as the bootstrap geometry while peeking a header to learn a file's real page size.
Usable data-area bytes: page_size - header_size - reserved_bytes_per_page.
Maximum payload an overflow page can hold: max_data_bytes - 2 (2 bytes for the payload-length field).
Freelist entries that fit on one freelist page: max_data_bytes / 12.
A creation-time geometry-validation failure.
Pretty-print a validation error.