Skip to main content

Module catalog

Module catalog 

Source
Expand description

Catalog (L5) — on-disk registry of collections.

See docs/format.md § Catalog for the authoritative on-disk shape. The catalog is a B+tree (M4 data structure) keyed by collection name and valued by postcard-encoded CollectionDescriptors. Its root page-id is recorded in the file header field root_catalog; the M2..M4 default of zero signals “no catalog yet” and Catalog::open_or_init creates one on first open.

§Power-of-ten posture

  • Rule 1. Catalog walks go through the M4 B+tree API which uses an explicit stack — no recursion in this module.
  • Rule 2. Catalog::list_collections is bounded by MAX_COLLECTIONS; exceeding the bound surfaces as Error::BTreeScanLimitExceeded.
  • Rule 5. Reserved-row presence is debug-asserted; the try_into chain in id_from_bytes is the runtime boundary.
  • Rule 7. Every fallible step propagates via ?; no unwrap on the production path.
  • Rule 9. No dyn — the catalog is generic over F: FileBackend and the B+tree it owns is monomorphised.

Structs§

Catalog
The catalog handle.
CollectionDescriptor
On-disk description of a collection.
IndexDescriptor
On-disk descriptor for a secondary index attached to a collection.

Enums§

IndexStatus
Lifecycle state of an IndexDescriptor.

Constants§

MAX_COLLECTIONS
Maximum number of collections a single catalog may carry. Bounds Catalog::list_collections (Rule 2) and the next-collection-id allocator below. 1 << 20 (1 048 576) is a generous ceiling — at 64-byte descriptor payloads the catalog would still fit in ~64 MiB.