@substrat-run/kernel 0.216.0 → 0.218.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attachment-gate.d.ts +42 -0
- package/dist/attachment-gate.d.ts.map +1 -0
- package/dist/attachment-gate.js +36 -0
- package/dist/attachment-gate.js.map +1 -0
- package/dist/broker-counts.d.ts +108 -0
- package/dist/broker-counts.d.ts.map +1 -0
- package/dist/broker-counts.js +101 -0
- package/dist/broker-counts.js.map +1 -0
- package/dist/broker-erasure.d.ts +51 -0
- package/dist/broker-erasure.d.ts.map +1 -0
- package/dist/broker-erasure.js +161 -0
- package/dist/broker-erasure.js.map +1 -0
- package/dist/broker-relay-erasure.d.ts +27 -0
- package/dist/broker-relay-erasure.d.ts.map +1 -0
- package/dist/broker-relay-erasure.js +115 -0
- package/dist/broker-relay-erasure.js.map +1 -0
- package/dist/broker-relay.d.ts +292 -0
- package/dist/broker-relay.d.ts.map +1 -0
- package/dist/broker-relay.js +494 -0
- package/dist/broker-relay.js.map +1 -0
- package/dist/broker-schema.d.ts +25 -0
- package/dist/broker-schema.d.ts.map +1 -0
- package/dist/broker-schema.js +256 -0
- package/dist/broker-schema.js.map +1 -0
- package/dist/broker-shadow.d.ts +258 -0
- package/dist/broker-shadow.d.ts.map +1 -0
- package/dist/broker-shadow.js +295 -0
- package/dist/broker-shadow.js.map +1 -0
- package/dist/broker-telemetry.d.ts +289 -0
- package/dist/broker-telemetry.d.ts.map +1 -0
- package/dist/broker-telemetry.js +336 -0
- package/dist/broker-telemetry.js.map +1 -0
- package/dist/cost-rollup.d.ts +6 -0
- package/dist/cost-rollup.d.ts.map +1 -1
- package/dist/cost-rollup.js +22 -1
- package/dist/cost-rollup.js.map +1 -1
- package/dist/delivery-broker.d.ts +320 -0
- package/dist/delivery-broker.d.ts.map +1 -0
- package/dist/delivery-broker.js +571 -0
- package/dist/delivery-broker.js.map +1 -0
- package/dist/delivery-policy.d.ts +105 -0
- package/dist/delivery-policy.d.ts.map +1 -0
- package/dist/delivery-policy.js +105 -0
- package/dist/delivery-policy.js.map +1 -0
- package/dist/directory-lake-keep.d.ts +9 -0
- package/dist/directory-lake-keep.d.ts.map +1 -0
- package/dist/directory-lake-keep.js +331 -0
- package/dist/directory-lake-keep.js.map +1 -0
- package/dist/directory-lake-projection.d.ts +50 -0
- package/dist/directory-lake-projection.d.ts.map +1 -0
- package/dist/directory-lake-projection.js +143 -0
- package/dist/directory-lake-projection.js.map +1 -0
- package/dist/directory-lake.d.ts +11 -1
- package/dist/directory-lake.d.ts.map +1 -1
- package/dist/directory-lake.js +3 -1
- package/dist/directory-lake.js.map +1 -1
- package/dist/index.d.ts +19 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/job-run.d.ts +21 -1
- package/dist/job-run.d.ts.map +1 -1
- package/dist/job-run.js +6 -0
- package/dist/job-run.js.map +1 -1
- package/dist/migration-digest.d.ts +2 -2
- package/dist/migration-digest.d.ts.map +1 -1
- package/dist/migration-digest.js +4 -2
- package/dist/migration-digest.js.map +1 -1
- package/dist/migration-fence.d.ts +1 -1
- package/dist/migration-fence.js +3 -3
- package/dist/migration-fence.js.map +1 -1
- package/dist/outbox-prune.d.ts +8 -1
- package/dist/outbox-prune.d.ts.map +1 -1
- package/dist/outbox-prune.js +6 -2
- package/dist/outbox-prune.js.map +1 -1
- package/dist/platform-sweep.d.ts +10 -1
- package/dist/platform-sweep.d.ts.map +1 -1
- package/dist/platform-sweep.js +37 -1
- package/dist/platform-sweep.js.map +1 -1
- package/dist/scope-host.d.ts +58 -8
- package/dist/scope-host.d.ts.map +1 -1
- package/dist/scope-host.js.map +1 -1
- package/dist/spine-guard.d.ts.map +1 -1
- package/dist/spine-guard.js +2 -0
- package/dist/spine-guard.js.map +1 -1
- package/dist/spine-restore.d.ts +14 -2
- package/dist/spine-restore.d.ts.map +1 -1
- package/dist/spine-restore.js.map +1 -1
- package/dist/store-driver-releases.d.ts +12 -3
- package/dist/store-driver-releases.d.ts.map +1 -1
- package/dist/store-driver-releases.js +12 -7
- package/dist/store-driver-releases.js.map +1 -1
- package/dist/subject-keys.d.ts +7 -0
- package/dist/subject-keys.d.ts.map +1 -1
- package/dist/subject-keys.js +29 -5
- package/dist/subject-keys.js.map +1 -1
- package/dist/subject-redaction.d.ts +7 -0
- package/dist/subject-redaction.d.ts.map +1 -1
- package/dist/subject-redaction.js +34 -27
- package/dist/subject-redaction.js.map +1 -1
- package/dist/table-ownership.d.ts +6 -0
- package/dist/table-ownership.d.ts.map +1 -1
- package/dist/table-ownership.js +17 -3
- package/dist/table-ownership.js.map +1 -1
- package/dist/vertical-owners.d.ts +1 -1
- package/dist/vertical-owners.d.ts.map +1 -1
- package/dist/vertical-owners.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
export const BROKER_SCHEMA = [
|
|
2
|
+
{
|
|
3
|
+
by: '#3467 (A1): messages and the handoff marks',
|
|
4
|
+
statements: [
|
|
5
|
+
`CREATE TABLE IF NOT EXISTS broker_messages (
|
|
6
|
+
id TEXT PRIMARY KEY,
|
|
7
|
+
kind TEXT NOT NULL,
|
|
8
|
+
tenant_id TEXT NOT NULL,
|
|
9
|
+
scope_id TEXT NOT NULL,
|
|
10
|
+
type TEXT NOT NULL,
|
|
11
|
+
body TEXT NOT NULL,
|
|
12
|
+
committed_at TEXT NOT NULL,
|
|
13
|
+
received_at INTEGER NOT NULL,
|
|
14
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
next_at INTEGER,
|
|
16
|
+
last_error TEXT,
|
|
17
|
+
delivered_at INTEGER
|
|
18
|
+
)`,
|
|
19
|
+
'CREATE INDEX IF NOT EXISTS broker_messages_due ON broker_messages (next_at) WHERE next_at IS NOT NULL',
|
|
20
|
+
`CREATE TABLE IF NOT EXISTS broker_marks (
|
|
21
|
+
tenant_id TEXT NOT NULL,
|
|
22
|
+
scope_id TEXT NOT NULL,
|
|
23
|
+
kind TEXT NOT NULL,
|
|
24
|
+
mark TEXT NOT NULL,
|
|
25
|
+
PRIMARY KEY (tenant_id, scope_id, kind)
|
|
26
|
+
)`,
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
by: '#3470 (A4): a delivery per (message, receiver), a breaker per receiver, the ordering key',
|
|
31
|
+
statements: [
|
|
32
|
+
// The sender's ordering key (RFC §4.5). NULL: the message is unordered at every receiver.
|
|
33
|
+
'ALTER TABLE broker_messages ADD COLUMN ordering_key TEXT',
|
|
34
|
+
// One row per (message, receiver) the message is for. A message with none is held: the broker
|
|
35
|
+
// had no receiver when it arrived. The message row keeps the content; this keeps the fate.
|
|
36
|
+
`CREATE TABLE broker_deliveries (
|
|
37
|
+
message_id TEXT NOT NULL,
|
|
38
|
+
receiver TEXT NOT NULL,
|
|
39
|
+
-- the message's ordering key when this receiver's subscription asks for order, else NULL
|
|
40
|
+
lane TEXT,
|
|
41
|
+
-- 'pending' | 'delivered' | 'dead' | 'discarded' | 'expired'
|
|
42
|
+
state TEXT NOT NULL,
|
|
43
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
44
|
+
-- pending: epoch ms of the next attempt. NULL in every other state
|
|
45
|
+
next_at INTEGER,
|
|
46
|
+
last_error TEXT,
|
|
47
|
+
-- the receiver's HTTP status on the last failure, when it gave one
|
|
48
|
+
last_status INTEGER,
|
|
49
|
+
-- dead: when the broker gave up on it
|
|
50
|
+
dead_at INTEGER,
|
|
51
|
+
-- delivered, discarded, expired: when it settled
|
|
52
|
+
settled_at INTEGER,
|
|
53
|
+
-- how many times a dead letter was resent
|
|
54
|
+
resends INTEGER NOT NULL DEFAULT 0,
|
|
55
|
+
PRIMARY KEY (message_id, receiver)
|
|
56
|
+
)`,
|
|
57
|
+
"CREATE INDEX broker_deliveries_due ON broker_deliveries (next_at) WHERE state = 'pending'",
|
|
58
|
+
// A lane's head: the lowest message id still pending or dead, per (receiver, lane).
|
|
59
|
+
`CREATE INDEX broker_deliveries_lane ON broker_deliveries (receiver, lane, message_id)
|
|
60
|
+
WHERE lane IS NOT NULL AND state IN ('pending', 'dead')`,
|
|
61
|
+
"CREATE INDEX broker_deliveries_dead ON broker_deliveries (dead_at) WHERE state = 'dead'",
|
|
62
|
+
// The pause per receiver (circuit breaker) and its slow-down (429, Retry-After).
|
|
63
|
+
`CREATE TABLE broker_receivers (
|
|
64
|
+
receiver TEXT PRIMARY KEY,
|
|
65
|
+
-- consecutive failures that count toward the pause; a success or a refusal resets it
|
|
66
|
+
failures INTEGER NOT NULL DEFAULT 0,
|
|
67
|
+
-- 1 while paused: once blocked_until passes, the next send is the one probe
|
|
68
|
+
open INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
-- the pause now in force, which a failed probe grows
|
|
70
|
+
pause_ms INTEGER,
|
|
71
|
+
-- epoch ms before which nothing is sent: a pause, or a slow-down
|
|
72
|
+
blocked_until INTEGER
|
|
73
|
+
)`,
|
|
74
|
+
// A1's single receiver becomes the subscription named 'default'; its state moves over.
|
|
75
|
+
`INSERT INTO broker_deliveries (message_id, receiver, state, attempts, next_at, last_error, settled_at)
|
|
76
|
+
SELECT id, 'default',
|
|
77
|
+
CASE WHEN delivered_at IS NOT NULL THEN 'delivered' ELSE 'pending' END,
|
|
78
|
+
attempts,
|
|
79
|
+
CASE WHEN delivered_at IS NULL THEN next_at END,
|
|
80
|
+
last_error,
|
|
81
|
+
delivered_at
|
|
82
|
+
FROM broker_messages WHERE delivered_at IS NOT NULL OR next_at IS NOT NULL`,
|
|
83
|
+
'DROP INDEX broker_messages_due',
|
|
84
|
+
'ALTER TABLE broker_messages DROP COLUMN attempts',
|
|
85
|
+
'ALTER TABLE broker_messages DROP COLUMN next_at',
|
|
86
|
+
'ALTER TABLE broker_messages DROP COLUMN last_error',
|
|
87
|
+
'ALTER TABLE broker_messages DROP COLUMN delivered_at',
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
by: '#3484: subject erasure, the tombstone a late handoff is screened against',
|
|
92
|
+
statements: [
|
|
93
|
+
// One row per erased (tenant, scope, subject), kept for good (`broker-erasure.ts`).
|
|
94
|
+
`CREATE TABLE broker_erased_subjects (
|
|
95
|
+
tenant_id TEXT NOT NULL,
|
|
96
|
+
scope_id TEXT NOT NULL,
|
|
97
|
+
subject_id TEXT NOT NULL,
|
|
98
|
+
erased_at TEXT NOT NULL,
|
|
99
|
+
PRIMARY KEY (tenant_id, scope_id, subject_id)
|
|
100
|
+
)`,
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
by: '#3469 (A3): broker to broker, and request-reply',
|
|
105
|
+
// The relay's tables (`broker-relay.ts`). None is the store's, and the store reads none of them.
|
|
106
|
+
// - broker_relay_hops: the sending side of an event, one row per (message, receiving app). The
|
|
107
|
+
// row with app = '' records that the subscribers were resolved, so a retry asks only when not.
|
|
108
|
+
// - broker_relay_outgoing: the requests and replies this broker originates (no outbox row has them).
|
|
109
|
+
// - broker_relay_inbox: what another app's broker relayed here, once per (calling app, id). A
|
|
110
|
+
// reply settles as it arrives; refusal keeps why one was refused, so a repeat is answered alike.
|
|
111
|
+
// - broker_waits: who waits for which request, until when, and what they were handed.
|
|
112
|
+
statements: [
|
|
113
|
+
`CREATE TABLE broker_relay_hops (
|
|
114
|
+
message_id TEXT NOT NULL,
|
|
115
|
+
app TEXT NOT NULL,
|
|
116
|
+
-- owed | accepted | no-broker | refused | unexported
|
|
117
|
+
state TEXT NOT NULL,
|
|
118
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
119
|
+
last_error TEXT,
|
|
120
|
+
updated_at INTEGER NOT NULL,
|
|
121
|
+
PRIMARY KEY (message_id, app)
|
|
122
|
+
)`,
|
|
123
|
+
`CREATE TABLE broker_relay_outgoing (
|
|
124
|
+
id TEXT PRIMARY KEY,
|
|
125
|
+
kind TEXT NOT NULL,
|
|
126
|
+
tenant_id TEXT NOT NULL,
|
|
127
|
+
scope_id TEXT NOT NULL,
|
|
128
|
+
to_app TEXT NOT NULL,
|
|
129
|
+
type TEXT NOT NULL,
|
|
130
|
+
body TEXT NOT NULL,
|
|
131
|
+
committed_at TEXT NOT NULL,
|
|
132
|
+
request_id TEXT,
|
|
133
|
+
deadline INTEGER,
|
|
134
|
+
-- due | accepted | no-broker | refused | abandoned
|
|
135
|
+
state TEXT NOT NULL,
|
|
136
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
137
|
+
next_at INTEGER,
|
|
138
|
+
last_error TEXT,
|
|
139
|
+
created_at INTEGER NOT NULL,
|
|
140
|
+
settled_at INTEGER
|
|
141
|
+
)`,
|
|
142
|
+
'CREATE INDEX broker_relay_outgoing_due ON broker_relay_outgoing (next_at) WHERE next_at IS NOT NULL',
|
|
143
|
+
`CREATE TABLE broker_relay_inbox (
|
|
144
|
+
caller_app TEXT NOT NULL,
|
|
145
|
+
id TEXT NOT NULL,
|
|
146
|
+
kind TEXT NOT NULL,
|
|
147
|
+
-- the envelope as the router handed it, its message's body within: content erasure reaches
|
|
148
|
+
envelope_body TEXT NOT NULL,
|
|
149
|
+
received_at INTEGER NOT NULL,
|
|
150
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
151
|
+
-- epoch ms of the next delivery to the scope, NULL once settled
|
|
152
|
+
next_at INTEGER,
|
|
153
|
+
last_error TEXT,
|
|
154
|
+
refusal TEXT,
|
|
155
|
+
settled_at INTEGER,
|
|
156
|
+
PRIMARY KEY (caller_app, id)
|
|
157
|
+
)`,
|
|
158
|
+
'CREATE INDEX broker_relay_inbox_due ON broker_relay_inbox (next_at) WHERE next_at IS NOT NULL',
|
|
159
|
+
`CREATE TABLE broker_waits (
|
|
160
|
+
request_id TEXT PRIMARY KEY,
|
|
161
|
+
tenant_id TEXT NOT NULL,
|
|
162
|
+
scope_id TEXT NOT NULL,
|
|
163
|
+
to_app TEXT NOT NULL,
|
|
164
|
+
resume TEXT NOT NULL,
|
|
165
|
+
deadline INTEGER NOT NULL,
|
|
166
|
+
-- waiting | answered | expired
|
|
167
|
+
state TEXT NOT NULL,
|
|
168
|
+
reason TEXT,
|
|
169
|
+
reply_id TEXT,
|
|
170
|
+
-- the paired reply, its body within: content erasure reaches
|
|
171
|
+
reply_body TEXT,
|
|
172
|
+
settled_at INTEGER,
|
|
173
|
+
resume_attempts INTEGER NOT NULL DEFAULT 0,
|
|
174
|
+
resume_next_at INTEGER,
|
|
175
|
+
resume_error TEXT,
|
|
176
|
+
resumed_at INTEGER
|
|
177
|
+
)`,
|
|
178
|
+
`CREATE INDEX broker_waits_waiting ON broker_waits (deadline) WHERE state = 'waiting'`,
|
|
179
|
+
'CREATE INDEX broker_waits_resume ON broker_waits (resume_next_at) WHERE resume_next_at IS NOT NULL',
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
by: '#3471 (A5): the mode a message was handed off under, the shadow recorder and its windows',
|
|
184
|
+
// `broker-shadow.ts`. Ids, types and times only: no table here holds a message's body.
|
|
185
|
+
statements: [
|
|
186
|
+
// 'shadow' | 'live', or NULL for a handoff that named no mode (every receiver, as A1–A4).
|
|
187
|
+
// Which receivers a held message is owed when receivers appear is read from it.
|
|
188
|
+
'ALTER TABLE broker_messages ADD COLUMN handoff_mode TEXT',
|
|
189
|
+
// One row per message the recorder got: the message row without its body, and when.
|
|
190
|
+
`CREATE TABLE broker_shadow_records (
|
|
191
|
+
message_id TEXT PRIMARY KEY,
|
|
192
|
+
kind TEXT NOT NULL,
|
|
193
|
+
tenant_id TEXT NOT NULL,
|
|
194
|
+
scope_id TEXT NOT NULL,
|
|
195
|
+
type TEXT NOT NULL,
|
|
196
|
+
committed_at TEXT NOT NULL,
|
|
197
|
+
received_at INTEGER NOT NULL,
|
|
198
|
+
recorded_at INTEGER NOT NULL
|
|
199
|
+
)`,
|
|
200
|
+
'CREATE INDEX broker_shadow_records_scope ON broker_shadow_records (scope_id, kind, message_id)',
|
|
201
|
+
'CREATE INDEX broker_shadow_records_age ON broker_shadow_records (recorded_at)',
|
|
202
|
+
// Where each scope's comparison window starts: the marks its handoff was seeded at.
|
|
203
|
+
`CREATE TABLE broker_shadow_starts (
|
|
204
|
+
tenant_id TEXT NOT NULL,
|
|
205
|
+
scope_id TEXT NOT NULL,
|
|
206
|
+
kind TEXT NOT NULL,
|
|
207
|
+
start_after TEXT NOT NULL,
|
|
208
|
+
started_at INTEGER NOT NULL,
|
|
209
|
+
PRIMARY KEY (tenant_id, scope_id, kind)
|
|
210
|
+
)`,
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
by: '#3474: the trace a message was committed under, and the exact counts the lake keeps',
|
|
215
|
+
statements: [
|
|
216
|
+
// The W3C trace id (#3386) of the request whose commit handed the message off, when the
|
|
217
|
+
// handoff ran inside it, and the invocation that wrote the outbox row (#1525's
|
|
218
|
+
// correlation, which joins to the trace through the invocation's own line). Ids only.
|
|
219
|
+
'ALTER TABLE broker_messages ADD COLUMN trace_id TEXT',
|
|
220
|
+
'ALTER TABLE broker_messages ADD COLUMN invocation_id TEXT',
|
|
221
|
+
// Exact counts per UTC day (`broker-counts.ts`): `n` counted, `shipped_n` of it in the lake.
|
|
222
|
+
`CREATE TABLE broker_count_days (
|
|
223
|
+
day TEXT NOT NULL,
|
|
224
|
+
tenant_id TEXT NOT NULL,
|
|
225
|
+
scope_id TEXT NOT NULL,
|
|
226
|
+
channel TEXT NOT NULL,
|
|
227
|
+
-- '' for a count that is not about a receiver (received)
|
|
228
|
+
receiver TEXT NOT NULL,
|
|
229
|
+
-- received | delivered | retried | dead | resent | discarded | expired
|
|
230
|
+
outcome TEXT NOT NULL,
|
|
231
|
+
n INTEGER NOT NULL DEFAULT 0,
|
|
232
|
+
shipped_n INTEGER NOT NULL DEFAULT 0,
|
|
233
|
+
-- epoch ms the count last moved: when it is due to ship
|
|
234
|
+
updated_at INTEGER NOT NULL,
|
|
235
|
+
PRIMARY KEY (day, tenant_id, scope_id, channel, receiver, outcome)
|
|
236
|
+
)`,
|
|
237
|
+
'CREATE INDEX broker_count_days_unshipped ON broker_count_days (updated_at) WHERE n > shipped_n',
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
];
|
|
241
|
+
/** Run the steps a broker's database has not run yet, each in one transaction. */
|
|
242
|
+
export function migrateBrokerStore(sql) {
|
|
243
|
+
sql.run('CREATE TABLE IF NOT EXISTS broker_schema (version INTEGER NOT NULL)');
|
|
244
|
+
const row = sql.all('SELECT version FROM broker_schema')[0];
|
|
245
|
+
const ran = Number(row?.version ?? 0);
|
|
246
|
+
if (!row)
|
|
247
|
+
sql.run('INSERT INTO broker_schema (version) VALUES (0)');
|
|
248
|
+
for (let i = ran; i < BROKER_SCHEMA.length; i++) {
|
|
249
|
+
sql.transaction(() => {
|
|
250
|
+
for (const statement of BROKER_SCHEMA[i].statements)
|
|
251
|
+
sql.run(statement);
|
|
252
|
+
sql.run('UPDATE broker_schema SET version = ?', i + 1);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=broker-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-schema.js","sourceRoot":"","sources":["../src/broker-schema.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAC,MAAM,aAAa,GAAgC;IACxD;QACE,EAAE,EAAE,4CAA4C;QAChD,UAAU,EAAE;YACV;;;;;;;;;;;;;SAaG;YACH,uGAAuG;YACvG;;;;;;SAMG;SACJ;KACF;IACD;QACE,EAAE,EAAE,0FAA0F;QAC9F,UAAU,EAAE;YACV,0FAA0F;YAC1F,0DAA0D;YAC1D,8FAA8F;YAC9F,2FAA2F;YAC3F;;;;;;;;;;;;;;;;;;;;SAoBG;YACH,2FAA2F;YAC3F,oFAAoF;YACpF;iEAC2D;YAC3D,yFAAyF;YACzF,iFAAiF;YACjF;;;;;;;;;;SAUG;YACH,uFAAuF;YACvF;;;;;;;sFAOgF;YAChF,gCA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CAAC,gDAAgD,CAAC,CAAC;IACpE,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE;YACnB,KAAK,MAAM,SAAS,IAAI,aAAa,CAAC,CAAC,CAAE,CAAC,UAAU;gBAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACzE,GAAG,CAAC,GAAG,CAAC,sCAAsC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A5 (#3471, rfc/broker-and-tenant-isolation.md §4.7): the broker in shadow beside the drain, the
|
|
3
|
+
* comparison of the two, and the switch that makes the broker the real path for a tenant.
|
|
4
|
+
*
|
|
5
|
+
* **Three modes, per tenant**, decided by the control plane (`DELIVERY_BROKER_SHADOW`,
|
|
6
|
+
* `DELIVERY_BROKER_LIVE`) and told to each scope on the answer to its wake (`wake.broker`):
|
|
7
|
+
*
|
|
8
|
+
* - `off`: the scope hands nothing off. The drain is the only path, as before A1.
|
|
9
|
+
* - `shadow`: the scope hands off, and the broker delivers every message to the recorder alone
|
|
10
|
+
* (`SHADOW_RECEIVER`). The recorder writes one row into the broker's own database and does
|
|
11
|
+
* nothing else: no consumer runs, no intent is executed, no call leaves. The drain stays the real
|
|
12
|
+
* path.
|
|
13
|
+
* - `live`: as `shadow`, and each intent is also owed to the real receiver (`LIVE_RECEIVER`), which
|
|
14
|
+
* asks the platform's drain engine to run that scope's intents now and holds the delivery until
|
|
15
|
+
* the intent is settled. The control plane stops driving that tenant's young intents itself; the
|
|
16
|
+
* broker is the one that asks. Events keep their existing path in every mode until their real
|
|
17
|
+
* receivers are hosted (the lake as a subscriber, A6; the relay, A3's hosted half), and are only
|
|
18
|
+
* recorded.
|
|
19
|
+
*
|
|
20
|
+
* **Which receivers a message is owed is fixed when the broker accepts it**, from the mode the
|
|
21
|
+
* scope handed it off under (`receiversFor`), and stored with the message (`handoff_mode`). That is
|
|
22
|
+
* the whole of the shadow guarantee: a message handed off in shadow has no delivery row at the real
|
|
23
|
+
* receiver, so no later pass, mode change or restart can send it there. A message handed off live
|
|
24
|
+
* keeps its live delivery after a cut-back, and the live receiver is idempotent on the intent's own
|
|
25
|
+
* state, so the drain taking it back and the broker finishing it never run it twice.
|
|
26
|
+
*
|
|
27
|
+
* **The recorder stores no content.** A record is the broker's own message row without its body —
|
|
28
|
+
* its id, kind, scope, type and commit time — plus when the recorder got it. A subject's erasure has
|
|
29
|
+
* nothing in it to redact (`broker-erasure.ts` reaches the bodies the broker holds, which this never
|
|
30
|
+
* copies).
|
|
31
|
+
*
|
|
32
|
+
* **The comparison** pairs, per (tenant, app), what the recorder got with what the drain did, read
|
|
33
|
+
* from each scope's own rows at comparison time (`witnessQueries`): an intent the drain settled
|
|
34
|
+
* (`settled_at`), an event it shipped to the lake (`drained_at`). Nothing is written on the drain's
|
|
35
|
+
* path to make that possible. The window starts at each scope's handoff start (the marks it was
|
|
36
|
+
* seeded at when the mode went on, `ShadowRecorder.start`) and ends `graceMs` ago: a message
|
|
37
|
+
* younger than that is in flight on one side or both, and is counted apart.
|
|
38
|
+
*/
|
|
39
|
+
import type { BrokerMessage, BrokerMessageKind, BrokerSql, DeliveryReceiver, HandoffMarks } from './delivery-broker.js';
|
|
40
|
+
export type DeliveryMode = 'off' | 'shadow' | 'live';
|
|
41
|
+
export declare const DELIVERY_MODES: readonly DeliveryMode[];
|
|
42
|
+
export declare const isDeliveryMode: (v: unknown) => v is DeliveryMode;
|
|
43
|
+
/** The recorder's subscription: every message handed off in shadow or live. */
|
|
44
|
+
export declare const SHADOW_RECEIVER = "shadow";
|
|
45
|
+
/** The real receiver's subscription: intents handed off live. */
|
|
46
|
+
export declare const LIVE_RECEIVER = "live";
|
|
47
|
+
/**
|
|
48
|
+
* The env var a script sets to hand off whatever the control plane says, owing every receiver as
|
|
49
|
+
* A1–A4 did: `always`. For a test worker or a self-hosted script with no control plane to ask. The
|
|
50
|
+
* uploader never sets it.
|
|
51
|
+
*/
|
|
52
|
+
export declare const DELIVERY_HANDOFF_ENV = "SUBSTRAT_DELIVERY_HANDOFF";
|
|
53
|
+
/** What a handoff says about the messages it carries (`DeliveryBroker.handOff`'s second argument). */
|
|
54
|
+
export interface HandOffOptions {
|
|
55
|
+
/** The mode the scope handed them off under. Absent (a scope from before A5, a harness): every receiver. */
|
|
56
|
+
mode?: 'shadow' | 'live';
|
|
57
|
+
/**
|
|
58
|
+
* The marks this scope began handing off after, when its mode last went on: the comparison's
|
|
59
|
+
* window starts there (`ShadowRecorder.start`). Sent, with no messages if need be, until the broker
|
|
60
|
+
* has acknowledged one handoff carrying it.
|
|
61
|
+
*/
|
|
62
|
+
start?: {
|
|
63
|
+
tenantId: string;
|
|
64
|
+
scopeId: string;
|
|
65
|
+
after: HandoffMarks;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The receivers a message is owed, from the mode it was handed off under: `undefined` is every
|
|
70
|
+
* receiver the store has (no mode: A1–A4's behaviour). Only names the store knows are owed.
|
|
71
|
+
*/
|
|
72
|
+
export declare function receiversFor(mode: string | null | undefined, kind: BrokerMessageKind): readonly string[] | undefined;
|
|
73
|
+
/** How long a record is kept: the week the comparison is read over, and a day. */
|
|
74
|
+
export declare const SHADOW_RETENTION_MS: number;
|
|
75
|
+
/** How young a message may be and still be in flight on either side: the drain's 15-minute pass, and the lake's 5. */
|
|
76
|
+
export declare const SHADOW_GRACE_MS: number;
|
|
77
|
+
/** One message as the recorder got it. No body, by construction. */
|
|
78
|
+
export interface ShadowRecord {
|
|
79
|
+
id: string;
|
|
80
|
+
kind: BrokerMessageKind;
|
|
81
|
+
tenantId: string;
|
|
82
|
+
scopeId: string;
|
|
83
|
+
type: string;
|
|
84
|
+
committedAt: string;
|
|
85
|
+
/** Epoch ms the broker accepted it, and the recorder got it. */
|
|
86
|
+
receivedAt: number;
|
|
87
|
+
recordedAt: number;
|
|
88
|
+
}
|
|
89
|
+
/** A scope the recorder has a window for. */
|
|
90
|
+
export interface ShadowScope {
|
|
91
|
+
tenantId: string;
|
|
92
|
+
scopeId: string;
|
|
93
|
+
/** The marks its handoff started after, per kind. */
|
|
94
|
+
start: HandoffMarks;
|
|
95
|
+
/** Epoch ms the window began. */
|
|
96
|
+
startedAt: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The recorder (the `SHADOW_RECEIVER` subscription) and the windows its comparison reads, over the
|
|
100
|
+
* broker's own database (`broker_shadow_records`, `broker_shadow_starts`; schema step 5).
|
|
101
|
+
*/
|
|
102
|
+
export declare class ShadowRecorder {
|
|
103
|
+
private readonly sql;
|
|
104
|
+
private readonly retentionMs;
|
|
105
|
+
constructor(sql: BrokerSql, opts?: {
|
|
106
|
+
retentionMs?: number;
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* The receiver: one row, copied from the broker's message row without its body. It writes nothing
|
|
110
|
+
* else anywhere and calls nothing: in shadow this is all a delivery does. Idempotent by id.
|
|
111
|
+
*/
|
|
112
|
+
receiver(now: () => number): DeliveryReceiver;
|
|
113
|
+
/** A scope's window starts after `marks`: a new start replaces the last, since the mode went on again. */
|
|
114
|
+
start(tenantId: string, scopeId: string, marks: HandoffMarks, now: number): void;
|
|
115
|
+
/** The scopes with a window, in scope id order, after `cursor`. */
|
|
116
|
+
scopes(limit: number, cursor?: string): ShadowScope[];
|
|
117
|
+
/** One scope's records inside its window: ids past its start, committed before `before`, at most `limit` per kind. */
|
|
118
|
+
records(scope: ShadowScope, before: string, limit: number): ShadowRecord[];
|
|
119
|
+
/** Drop records past their retention (K-70). Windows stay: one row per scope and kind. */
|
|
120
|
+
prune(now: number): void;
|
|
121
|
+
/** Epoch ms the oldest record's retention runs out, or null when it holds none. */
|
|
122
|
+
nextWakeAt(): number | null;
|
|
123
|
+
}
|
|
124
|
+
/** What the drain did with one message, as its scope's own rows say. */
|
|
125
|
+
export interface DeliveryWitness {
|
|
126
|
+
id: string;
|
|
127
|
+
kind: BrokerMessageKind;
|
|
128
|
+
committedAt: string;
|
|
129
|
+
/** When the drain delivered it (the intent's `settled_at`, the event's `drained_at`), or null while it has not. */
|
|
130
|
+
deliveredAt: string | null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The scope's half of the comparison: its own messages past `after`, committed before `before`,
|
|
134
|
+
* with what the drain did with each. Two reads by primary key range, both `emittedHere`, as the
|
|
135
|
+
* handoff's own reads are, so the two sides count the same rows.
|
|
136
|
+
*/
|
|
137
|
+
export declare function witnessQueries(after: HandoffMarks, before: string, limit: number): {
|
|
138
|
+
kind: BrokerMessageKind;
|
|
139
|
+
sql: string;
|
|
140
|
+
params: unknown[];
|
|
141
|
+
}[];
|
|
142
|
+
/** A witness read's rows, as witnesses. */
|
|
143
|
+
export declare function witnessesOf(kind: BrokerMessageKind, rows: readonly Record<string, unknown>[]): DeliveryWitness[];
|
|
144
|
+
/** Latency, in ms from commit: how many, the median, the 95th percentile and the worst. */
|
|
145
|
+
export interface LatencyStats {
|
|
146
|
+
n: number;
|
|
147
|
+
p50: number;
|
|
148
|
+
p95: number;
|
|
149
|
+
max: number;
|
|
150
|
+
}
|
|
151
|
+
/** One kind's comparison. */
|
|
152
|
+
export interface KindComparison {
|
|
153
|
+
/** Messages in the window on either side. */
|
|
154
|
+
compared: number;
|
|
155
|
+
/** Delivered by both. */
|
|
156
|
+
both: number;
|
|
157
|
+
/** Delivered by the drain, never recorded by the broker: a handoff that did not happen, or was lost. */
|
|
158
|
+
drainOnly: number;
|
|
159
|
+
/** Recorded by the broker, not delivered by the drain (yet): the drain is behind, or has no path for it here. */
|
|
160
|
+
brokerOnly: number;
|
|
161
|
+
/** Delivered by neither: pending on both sides. */
|
|
162
|
+
neither: number;
|
|
163
|
+
/** The first ids of each difference, for an operator to look up. */
|
|
164
|
+
drainOnlyIds: string[];
|
|
165
|
+
brokerOnlyIds: string[];
|
|
166
|
+
latencyMs: {
|
|
167
|
+
drain: LatencyStats | null;
|
|
168
|
+
broker: LatencyStats | null;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** How many ids of each difference a comparison names. */
|
|
172
|
+
export declare const COMPARISON_SAMPLE = 20;
|
|
173
|
+
/**
|
|
174
|
+
* Pair what the recorder got with what the drain did, for one kind. A record and a witness are the
|
|
175
|
+
* same message by id. Latency is from the message's commit: to the drain's delivery, and to the
|
|
176
|
+
* recorder's (which is the broker's whole path: handoff, store, pass).
|
|
177
|
+
*/
|
|
178
|
+
export declare function compareKind(records: readonly ShadowRecord[], witnesses: readonly DeliveryWitness[]): KindComparison;
|
|
179
|
+
/** A scope whose witness could not be read, so its messages are not in the comparison. */
|
|
180
|
+
export interface UnreadScope {
|
|
181
|
+
scopeId: string;
|
|
182
|
+
error: string;
|
|
183
|
+
}
|
|
184
|
+
/** The comparison for one (tenant, app), as staff read it. Ids, types and times only. */
|
|
185
|
+
export interface DeliveryComparison {
|
|
186
|
+
tenantId: string;
|
|
187
|
+
app: string;
|
|
188
|
+
/** Epoch ms it was read, and the window's end as an instant: younger messages are in flight. */
|
|
189
|
+
at: number;
|
|
190
|
+
before: string;
|
|
191
|
+
/** Scopes compared, and those whose witness could not be read. */
|
|
192
|
+
scopes: number;
|
|
193
|
+
unread: UnreadScope[];
|
|
194
|
+
/** A scope or a kind held more than one read takes: the counts are a floor. */
|
|
195
|
+
truncated: boolean;
|
|
196
|
+
/** Where the next page of scopes starts, or null. */
|
|
197
|
+
nextCursor: string | null;
|
|
198
|
+
event: KindComparison;
|
|
199
|
+
intent: KindComparison;
|
|
200
|
+
}
|
|
201
|
+
/** How many messages of each kind one scope contributes to one read. */
|
|
202
|
+
export declare const COMPARISON_PER_SCOPE = 1000;
|
|
203
|
+
/** How many scopes one comparison read covers; `nextCursor` names the rest. */
|
|
204
|
+
export declare const COMPARISON_SCOPES = 50;
|
|
205
|
+
/** One scope's witness, however the broker reaches its scope. */
|
|
206
|
+
export type WitnessReader = (scope: ShadowScope, before: string, limit: number) => Promise<DeliveryWitness[]>;
|
|
207
|
+
/**
|
|
208
|
+
* The comparison, both adapters' brokers: each scope with a window, its records against its
|
|
209
|
+
* witness. A scope whose witness throws is named in `unread`, never counted as all broker-only.
|
|
210
|
+
*/
|
|
211
|
+
export declare function compareDeliveries(recorder: ShadowRecorder, witness: WitnessReader, ids: {
|
|
212
|
+
tenantId: string;
|
|
213
|
+
app: string;
|
|
214
|
+
}, opts: {
|
|
215
|
+
now: number;
|
|
216
|
+
graceMs?: number;
|
|
217
|
+
cursor?: string;
|
|
218
|
+
scopes?: number;
|
|
219
|
+
perScope?: number;
|
|
220
|
+
}): Promise<DeliveryComparison>;
|
|
221
|
+
/** Where an intent stands in its scope, as the live receiver asks it. */
|
|
222
|
+
export type IntentState = 'pending' | 'settled' | 'absent';
|
|
223
|
+
/** The reads `intentStateQuery` makes: one primary-key read. */
|
|
224
|
+
export declare const intentStateQuery: (id: string) => {
|
|
225
|
+
sql: string;
|
|
226
|
+
params: unknown[];
|
|
227
|
+
};
|
|
228
|
+
/** An intent's state from `intentStateQuery`'s rows. */
|
|
229
|
+
export declare const intentStateOf: (rows: readonly {
|
|
230
|
+
status?: unknown;
|
|
231
|
+
}[]) => IntentState;
|
|
232
|
+
/** What the platform answered the live receiver's ask: it ran (or queued) the drain, or the tenant is not live. */
|
|
233
|
+
export type DriveAnswer = 'driven' | 'not-live';
|
|
234
|
+
export interface LiveIntentReceiverDeps {
|
|
235
|
+
/** The intent's state in its scope, now. */
|
|
236
|
+
state(message: BrokerMessage): Promise<IntentState>;
|
|
237
|
+
/** Ask the platform's drain engine to run this scope's intents. Throws when the ask did not land. */
|
|
238
|
+
drive(message: BrokerMessage): Promise<DriveAnswer>;
|
|
239
|
+
/** The waits between looks at the intent after asking; their sum is how long one attempt waits. */
|
|
240
|
+
settleWaitsMs?: readonly number[];
|
|
241
|
+
sleep?: (ms: number) => Promise<void>;
|
|
242
|
+
}
|
|
243
|
+
/** The live receiver's default looks after an ask: half a second, then one, two and four. */
|
|
244
|
+
export declare const LIVE_SETTLE_WAITS_MS: readonly number[];
|
|
245
|
+
/**
|
|
246
|
+
* The real receiver (`LIVE_RECEIVER`): an intent is delivered once it is no longer pending in its
|
|
247
|
+
* scope. The broker does not run the intent itself; the drain engine does, as it always has, so an
|
|
248
|
+
* intent is executed by one engine whichever path asked, and the ask is idempotent on the intent's
|
|
249
|
+
* own state. A settled or absent intent is delivered at once (another driver took it). A pending
|
|
250
|
+
* one is asked for and looked at again; still pending, the attempt fails and the broker retries it
|
|
251
|
+
* under its policy. An event is never owed here (`receiversFor`), and is delivered as a no-op if one
|
|
252
|
+
* ever is.
|
|
253
|
+
*
|
|
254
|
+
* `not-live`: the platform says this tenant is not live (a cut-back). The intent is the drain's
|
|
255
|
+
* again, and the delivery settles here, so the broker never asks twice for what it no longer owns.
|
|
256
|
+
*/
|
|
257
|
+
export declare function liveIntentReceiver(deps: LiveIntentReceiverDeps): DeliveryReceiver;
|
|
258
|
+
//# sourceMappingURL=broker-shadow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-shadow.d.ts","sourceRoot":"","sources":["../src/broker-shadow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIxH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErD,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAA8B,CAAC;AAEjF,eAAO,MAAM,cAAc,MAAO,OAAO,KAAG,CAAC,IAAI,YAA0F,CAAC;AAE5I,+EAA+E;AAC/E,eAAO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