package granary

  1. Overview
  2. Docs
Pure-OCaml SQL engine

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.0.3.tar.gz
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11

doc/granary.encoding/Granary_encoding/Schema_fingerprint/index.html

Module Granary_encoding.Schema_fingerprintSource

Stable 64-bit fingerprint of a table's schema *shape*, for corruption recovery (#174 / #85), schema-drift detection on open, and replication schema-matching (#92 / #172).

The fingerprint is a pure function of the column list (names, types, and every flag that affects how a stored row decodes) plus the without_rowid flag. It deliberately excludes volatile / identity fields — the table name, tree_id, and the rowid counter — so it is stable across table renames and captures only what is required to decode a row.

It is computed with FNV-1a 64-bit over a versioned, length-delimited canonical serialization, so it is deterministic and stable across runs, machines, and library versions (unlike Hashtbl.hash).

Sourceval compute : columns:Row.column list -> without_rowid:bool -> int64

compute ~columns ~without_rowid is the 64-bit schema fingerprint.

Sourceval low32 : int64 -> int32

Low 32 bits of a fingerprint — used to stamp the 4-byte reserved page header field (#174 page-stamp).