1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Durable free-page list, stored as a chain of `PageKind::Free` pages rooted
//! at the A/B header's `free_list_root` slot — outside the catalog B+ tree.
//!
//! Keeping the free list out of the catalog is what makes free-page recycling
//! both **durable** (it survives an unclean shutdown — the chain is committed
//! atomically with the header swap) and **bounded** (maintaining it never
//! copies-on-writes the catalog tree, so it adds no per-commit catalog churn).
//!
//! Each entry is a `(commit_id, page_id)` pair: `commit_id` is the commit that
//! freed the page, used at `begin_write` to decide which pages are below the
//! reclamation floor (observable by no reader and no retained-history root) and
//! therefore safe to recycle now. The chain stores *every* free page — those
//! still pinned are simply carried forward until the floor advances past them.
//!
//! The chain is singly linked and self-describing: each page carries its own
//! `next` and entry count, no page encodes another page's offset, and the
//! header publishes only the head. A **prefix rewrite** therefore needs no
//! format change — write J fresh pages, point the last one's `next` at the
//! first retained tail page, publish the new head — and it is what keeps the
//! write hot path's resident cost independent of how many pages are free.
pub
pub
pub
pub
pub use WINDOW_PAGES;
pub use CHAIN_METADATA_CID;
pub use ;
pub use rewrite_chain;
// Forging a chain by hand is a test-only need: production writes go through
// `rewrite_chain`, which owns host selection and the tail splice.
pub use chain_capacity;
pub use write_chain;