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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
//! The JOURNAL declaration's emission: the canonical record, and the row contract over it.
//!
//! ```ignore
//! #[ingraph::journal(root = "MediaId", sqlite)]
//! pub struct VideoJournal;
//! ```
//!
//! # It emits a RECORD, and that is the whole design
//!
//! What the word mounts is not a second kind of thing. [`columns`] mints the four the organ is
//! keyed and read by, the front end hands them to the ORDINARY record pass under
//! [`NodeKind::Record`](crate::model::NodeKind::Record), and this model emits that record's own
//! expansion plus one impl. So a mounted journal has the `*Key` type, the accessor family, the
//! per-database row, the comparison lowering, the order-by vocabulary and the cursor that every
//! declared record has — because it IS one — and a deployment queries its run state exactly as it
//! queries anything else it declared.
//!
//! The one thing added is [`JournalModel::row`]: `impl JournalRow<Root>`, which is the same trait
//! the HAND path implements by hand. The macro is sugar over that contract and never a replacement,
//! so the two paths meet at one seam and a writer cannot tell them apart.
//!
//! # The four columns, and why each is the one it is
//!
//! | column | type | why |
//! |---|---|---|
//! | `root` | the type `root = "…"` named | one journal table per ROOT FAMILY, and the root is that family |
//! | `node` | `String` | `NodeName`'s storable face, which is what the hand corpus already stores |
//! | `station` | `String` | `Station`'s, for the same reason — the framework's own stable word |
//! | `at` | `Timestamp` | the framework's own instant: feature-free, and stored on every backend |
//!
//! `root` is the LINEAGE and `node` is the ID, so `key = lineage ⊕ id` spells `(root, node)` with
//! nothing declared for it — and the keyed replace that makes an entry the LAST STATE is the
//! ordinary write of that key. That is the organ's semantics arriving from the record law rather
//! than from anything written here.
//!
//! `root`'s CITIZENSHIP is not checked here and is not left unchecked: it is a key column of an
//! ordinary record, so a type no backend can store is the storability audit's own refusal, at the
//! declaration that named it.
//!
//! # `SystemTime` → `Timestamp`: the crossing PANICS, and the alternative is a durable lie
//!
//! [`JournalRow::of`](../../ingraph/trait.JournalRow.html) is handed a `SystemTime` and the `at`
//! column is a `Timestamp`, whose range is jiff's ±9999 years. The conversion is `TryFrom` rather
//! than `From` on purpose — `ingraph::Timestamp`'s own note says why: *a saturating `From` would
//! substitute an instant for the one a caller handed over*.
//!
//! The signature this emission has to satisfy returns `Self` and cannot report a refusal, so the
//! two available postures are to substitute an instant or to stop. It stops. A journal row is
//! DURABLE and is read as *when this node got there*, so a substituted instant is a row asserting a
//! moment that never happened — and what reaches this crossing is a system clock wrong by thousands
//! of years rather than a value worth rounding. The panic names the fact and carries jiff's own
//! refusal; a deployment that would rather keep the row writes the HAND path, whose `of` is its own
//! and may say whatever it likes about an instant it cannot hold.
use quote;
use crateRecordModel;
/// A validated journal declaration, ready to emit.
///
/// PLAIN, for the reason every model in this crate has plain fields: the derive today and a
/// manifest front end later reach the same emitter.
/// `impl JournalRow<Root>` — the four things the framework knows, mapped onto the four columns.
///
/// A free function over the three tokens it spends rather than a method, so the claim about what it
/// writes is readable without assembling a whole record model to make it.
///
/// Every path is rooted through the shelf, as every emitted framework path is, and every trait item
/// is reached in qualified form: an expansion lands in a namespace whose `From` and whose `TryFrom`
/// are not necessarily the ones this code means.
pub
/// The four canonical columns, minted whole — the ONE authority for a mounted journal's shape.
///
/// Handed back as a declaration's own field list, markers and all, because that is what the record
/// pass reads: the front end swaps them into the host it was given and every rule downstream is the
/// rule that was already there. Nothing about the shape is decided twice.
///
/// The four columns are the SAME four whether or not the journal named a store, which is the
/// participation inversion read from the mint's side.
///
/// The `root` column used to carry a bare `#[ingraph(persist)]` and the other three used to carry
/// one beside their own word, both only where a storage block had been written — because the marker
/// was what put a column in the row. Data fields ARE the row now, so a marker that says so is a word
/// nobody reads, and the branch that wrote it is gone with it. WHICH RUNG the mount lands on is the
/// front end's, decided from the store words and spent as the node kind it parses under; nothing
/// about the column list depends on it.
///
/// The KEY-side columns (`root` and `node`) carry no family label and cannot: a label on a key
/// column is refused by the record grammar, the key's own crossing being decided by its type.