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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! The adjacency store tier (ADR-0031 / ADR-0033 / ADR-0551 / ADR-0599):
//! the live delta and its hop order in [`delta`](self::delta), and the
//! sealed tier here — compressed immutable hop chunks plus versioned
//! tombstones, held in one graph-level, node-major [`SealedArena`].
//!
//! The sealed tier is a `Graph`-level structure keyed by node and direction
//! ([`SealedArena`], one per direction); a node that never folds has no
//! entry in it. The chunk bytes live in the arena's single `Vec<u8>` — a
//! node's chunks adjacent — addressed by a per-node span of 12-byte
//! [`Entry`]s (`type_id`, arena `off`, hop count), replacing the old
//! per-chunk `Vec<u8>`. The codec's leading `u32` hop-count header is gone:
//! the count rides the entry, and the first raw id leads the id stream the
//! entry points at.
//!
//! Not to be confused with [`crate::graph::adjacency`], the graph's
//! adjacency accessors (degree, neighbor iteration, snapshot-visible
//! traversal) that read and write this tier.
//!
//! A chunk is folded — delta and reclaimed tombstones merged into the sealed
//! stream — at the delta-size watermark (a never-sealed chunk reaching
//! [`COMPACTION_DELTA_FLOOR`] hops, or a delta past 25% of the sealed hops,
//! or a tombstone reclaimable at the GC horizon). A due chunk never drags its
//! siblings. See ADR-0551 for the gate and the confluence argument.
//!
//! The fold appends the new encoding to the arena and marks the replaced
//! range dead; arena compaction rides the checkpoint fold
//! ([`SealedArena::compact`]).
pub use ;
use Ordering;
use HashSet;
use size_of;
use RelId;
/// The paging format's reader surface, for the correctness suite's
/// pruning proofs outside this module (the format stays test-gated until
/// a consumer engages it).
pub use ;
use crate;
/// A never-sealed chunk seals only when its delta reaches this hop count
/// (ADR-0551: the measured knee of the cutoff sweep).
pub const COMPACTION_DELTA_FLOOR: usize = 32;
/// A rebuilt chunk whose delta reaches this hop count is sealed by the
/// wholesale adjacency build's own pass (ADR-0599 / ADR-0608). The measured
/// break-even from the seal-policy record: sealing swaps a chunk's 24 B/hop
/// delta heap for a 56 B sealed entry plus a ~1.1 B/hop stream while its
/// 32 B delta entry is retained either way — net positive at 4 hops, a wash
/// at 3, a loss below. Deliberately below [`COMPACTION_DELTA_FLOOR`] (32):
/// the build folds short chunks the write path leaves delta.
pub const RESTORE_SEAL_HOPS: usize = 4;
/// The read timestamp that hides nothing: a tombstone's `xmax` is always
/// at least 1 (the write path stamps from the commit clock, which starts
/// there), so a read at 0 walks the raw physical adjacency in merged order.
pub const PHYSICAL_READ_TS: u64 = 0;
/// The paging format's hop-count header writer (test-gated with `pages`).
pub use hop_count;
pub use ;
pub use ;
/// Bytes the entry array and its tombstone column gain from `added` new
/// entries, at the lengths `entries`/`tombstones` hold now.
pub
/// Floor bytes one fresh joining chunk brings besides the entry-column growth:
/// its tombstone slots (the zero-hop stream appends no arena bytes, ADR-0599).
/// The apply path is `tombstone_deleted` on a never-sealed type, so the
/// admission estimate needs the same term.
pub
/// Merge a delta chunk's raw hop slice — with its presence boundary, so
/// each hop resolves through [`resolve`] — and a decoded sealed chunk in
/// `cmp_ts_desc` order. Both inputs are already sorted; on a tie the delta
/// hop goes first.
pub
/// Drop the hops whose tombstone stamp is at or below `horizon`, from the
/// sealed stream and the delta, returning the tombstones that still apply.
/// The sealed position goes on its supersede stamp, the delta hop on its
/// delete stamp, and the tombstone stays while either stamp is above the
/// horizon — a delete after a reposition reclaims the sealed position while
/// its relocated hop stays readable. A deleted row's delta hop dies with its
/// sealed position: once the fold seals it, the chain GC can no longer prune
/// it and it would be a ghost. A reposition's delta hop is the id's live
/// position and stays.
pub