@substrat-run/adapter-cloudflare 0.235.0 → 0.237.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/broker-facet-seam.d.ts +126 -0
- package/dist/broker-facet-seam.d.ts.map +1 -0
- package/dist/broker-facet-seam.js +67 -0
- package/dist/broker-facet-seam.js.map +1 -0
- package/dist/connection-sweep-do.d.ts +3 -3
- package/dist/connection-sweep-do.d.ts.map +1 -1
- package/dist/connection-sweep-do.js +1 -1
- package/dist/connection-sweep-do.js.map +1 -1
- package/dist/control-plane-do.d.ts +19 -12
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +68 -38
- package/dist/control-plane-do.js.map +1 -1
- package/dist/delivery-broker-do.d.ts +31 -1
- package/dist/delivery-broker-do.d.ts.map +1 -1
- package/dist/delivery-broker-do.js +122 -12
- package/dist/delivery-broker-do.js.map +1 -1
- package/dist/delivery-broker-facet.d.ts +46 -0
- package/dist/delivery-broker-facet.d.ts.map +1 -0
- package/dist/delivery-broker-facet.js +71 -0
- package/dist/delivery-broker-facet.js.map +1 -0
- package/dist/delivery-broker-supervisor-do.d.ts +88 -0
- package/dist/delivery-broker-supervisor-do.d.ts.map +1 -0
- package/dist/delivery-broker-supervisor-do.js +381 -0
- package/dist/delivery-broker-supervisor-do.js.map +1 -0
- package/dist/directory-cutover.d.ts +9 -0
- package/dist/directory-cutover.d.ts.map +1 -1
- package/dist/directory-cutover.js +33 -4
- package/dist/directory-cutover.js.map +1 -1
- package/dist/directory-split-inventory.js +1 -1
- package/dist/directory-split-inventory.js.map +1 -1
- package/dist/host.d.ts +33 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +72 -1
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/peer-read-evidence.d.ts +118 -0
- package/dist/peer-read-evidence.d.ts.map +1 -0
- package/dist/peer-read-evidence.js +223 -0
- package/dist/peer-read-evidence.js.map +1 -0
- package/dist/route-read-model.d.ts +9 -0
- package/dist/route-read-model.d.ts.map +1 -1
- package/dist/route-read-model.js +34 -20
- package/dist/route-read-model.js.map +1 -1
- package/dist/route-resolver.d.ts +23 -3
- package/dist/route-resolver.d.ts.map +1 -1
- package/dist/route-resolver.js +12 -9
- package/dist/route-resolver.js.map +1 -1
- package/dist/scope-do.d.ts.map +1 -1
- package/dist/scope-do.js +5 -1
- package/dist/scope-do.js.map +1 -1
- package/dist/scope-supervisor-do.d.ts +8 -0
- package/dist/scope-supervisor-do.d.ts.map +1 -1
- package/dist/scope-supervisor-do.js +74 -3
- package/dist/scope-supervisor-do.js.map +1 -1
- package/dist/scope-work.d.ts +1 -1
- package/dist/scope-work.js +1 -1
- package/dist/scope-work.js.map +1 -1
- package/dist/supervisor-identity.d.ts +82 -0
- package/dist/supervisor-identity.d.ts.map +1 -0
- package/dist/supervisor-identity.js +128 -0
- package/dist/supervisor-identity.js.map +1 -0
- package/dist/supplied-delivery-broker.d.ts +3 -0
- package/dist/supplied-delivery-broker.d.ts.map +1 -1
- package/dist/supplied-delivery-broker.js +3 -0
- package/dist/supplied-delivery-broker.js.map +1 -1
- package/dist/tenant-due-work-do.d.ts +46 -2
- package/dist/tenant-due-work-do.d.ts.map +1 -1
- package/dist/tenant-due-work-do.js +62 -12
- package/dist/tenant-due-work-do.js.map +1 -1
- package/package.json +12 -12
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track B (broker RFC §6.2, #3466): what the delivery broker's supervisor and the broker class in
|
|
3
|
+
* facet mode share, and the two fences between a broker as it runs today and a broker as a facet.
|
|
4
|
+
*
|
|
5
|
+
* Imports nothing from `delivery-broker-do.ts`, so the broker class can call the rollback fence
|
|
6
|
+
* without a cycle, and the supervisor can read the same names. The scope's half of the same seam is
|
|
7
|
+
* `scope-facets.ts`; the marker table is the one the scope supervisor writes, since a broker object
|
|
8
|
+
* and a scope object never share storage.
|
|
9
|
+
*
|
|
10
|
+
* **Nothing here moves data.** A facet's SQLite is separate from the storage a broker object holds
|
|
11
|
+
* today, so an existing broker's rows stay where they are, and the fences make that safe both ways:
|
|
12
|
+
*
|
|
13
|
+
* - **Forward fence.** A broker supervisor woken on an object whose own storage holds a broker's rows
|
|
14
|
+
* (it ran as a broker before facets) refuses every call. Serving it from an empty facet would lose
|
|
15
|
+
* every message it holds, and its marks would send each scope's backlog again.
|
|
16
|
+
* - **Rollback fence.** A broker supervisor writes `SUPERVISOR_MARKER_TABLE` into its object's own
|
|
17
|
+
* storage before its first call into the facet, and the broker class as an object refuses to
|
|
18
|
+
* construct on storage carrying it. Rolling back would otherwise start an empty broker beside the
|
|
19
|
+
* facet's rows, and the scopes would hand off their whole outbox to it again.
|
|
20
|
+
*/
|
|
21
|
+
import type { DeliveryWitness, DriveAnswer, EventLakeState, HandoffMarks, IntentState, LakeShipAnswer } from '@substrat-run/kernel';
|
|
22
|
+
/** What the forward fence answers with. A class, so a caller can tell it from the broker's own errors. */
|
|
23
|
+
export declare class BrokerFacetFenced extends Error {
|
|
24
|
+
readonly name = "BrokerFacetFenced";
|
|
25
|
+
}
|
|
26
|
+
/** What the rollback fence throws from the broker class's constructor. */
|
|
27
|
+
export declare class BrokerSupervisedFenced extends Error {
|
|
28
|
+
readonly name = "BrokerSupervisedFenced";
|
|
29
|
+
}
|
|
30
|
+
/** The narrow storage read both fences need: synchronous SQL over the object's own database. */
|
|
31
|
+
interface FenceStorage {
|
|
32
|
+
readonly sql: {
|
|
33
|
+
exec(query: string, ...params: unknown[]): {
|
|
34
|
+
toArray(): unknown[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Does this object's own storage hold a broker's rows (the forward fence's question)? Any row in a
|
|
40
|
+
* `broker_*` table but `broker_schema`, which a broker writes when it wakes whether or not it was
|
|
41
|
+
* ever handed anything.
|
|
42
|
+
*/
|
|
43
|
+
export declare function holdsBrokerData(storage: FenceStorage): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The rollback fence, run by the broker class as an object before it creates any table of its own.
|
|
46
|
+
* Read-only: one `sqlite_master` lookup per wake, and on an object no supervisor ever served it
|
|
47
|
+
* finds nothing and changes nothing.
|
|
48
|
+
*/
|
|
49
|
+
export declare function assertBrokerNotSupervised(storage: FenceStorage): void;
|
|
50
|
+
/**
|
|
51
|
+
* The answer to an ask that can fail as a delivery fails: plain values, since an error crossing RPC
|
|
52
|
+
* keeps its message and loses the `DeliveryFailure` detail (status, retry-after, permanent) the
|
|
53
|
+
* broker's policy reads. The facet throws it again as a `DeliveryFailure`.
|
|
54
|
+
*/
|
|
55
|
+
export type BrokerAsk<T> = {
|
|
56
|
+
readonly ok: true;
|
|
57
|
+
readonly value: T;
|
|
58
|
+
} | {
|
|
59
|
+
readonly ok: false;
|
|
60
|
+
readonly message: string;
|
|
61
|
+
readonly status?: number;
|
|
62
|
+
readonly retryAfterMs?: number;
|
|
63
|
+
readonly permanent?: boolean;
|
|
64
|
+
};
|
|
65
|
+
/** The scope reads a broker's receivers make, and nothing else of the scope's surface. */
|
|
66
|
+
export declare const BROKER_SCOPE_READS: readonly ['intentDeliveryState', 'eventLakeState'];
|
|
67
|
+
export type BrokerScopeRead = (typeof BROKER_SCOPE_READS)[number];
|
|
68
|
+
/**
|
|
69
|
+
* What a broker facet may ask its supervisor for, during a call (broker RFC §6.2: "only references
|
|
70
|
+
* the supervisor passes with the call"). Every method is pinned by the supervisor to the broker it
|
|
71
|
+
* serves: the tenant its object is named for, and a scope only once a handoff from that scope has
|
|
72
|
+
* passed through the supervisor. The control plane's origin, the platform secret and the `SCOPE`
|
|
73
|
+
* namespace stay in the supervisor; the facet gets answers.
|
|
74
|
+
*/
|
|
75
|
+
export interface BrokerPlatformHandle {
|
|
76
|
+
/** A5, A6: one primary-key read of a scope's intent or event state, for a receiver. */
|
|
77
|
+
scopeState(scopeId: string, read: BrokerScopeRead, id: string): Promise<IntentState | EventLakeState>;
|
|
78
|
+
/** A5: a scope's own witness of what its drain did, for the staff comparison. */
|
|
79
|
+
witness(scopeId: string, after: HandoffMarks, before: string, limit: number, since?: string): Promise<DeliveryWitness[]>;
|
|
80
|
+
/** A5: ask the control plane to drain one scope's intents now (`askControlPlaneToDrain`). */
|
|
81
|
+
drain(message: {
|
|
82
|
+
tenantId: string;
|
|
83
|
+
scopeId: string;
|
|
84
|
+
}): Promise<BrokerAsk<DriveAnswer>>;
|
|
85
|
+
/** A6: ask the control plane to ship one scope's events to the lake now (`askControlPlaneToShip`). */
|
|
86
|
+
ship(message: {
|
|
87
|
+
tenantId: string;
|
|
88
|
+
scopeId: string;
|
|
89
|
+
}): Promise<BrokerAsk<LakeShipAnswer>>;
|
|
90
|
+
}
|
|
91
|
+
/** What one supervised call returns besides its value: the broker's next wake, read from its store. */
|
|
92
|
+
export interface BrokerSupervisedReply<T = unknown> {
|
|
93
|
+
readonly value: T;
|
|
94
|
+
/** The instant (epoch ms) the broker next needs its alarm, or null when it holds nothing to wake for. */
|
|
95
|
+
readonly wakeAt: number | null;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The env a broker facet's receivers are built over. Not bindings: the broker's name, compiled into
|
|
99
|
+
* the facet's entry as a constant (the isolate id carries the whole name, so it never differs between
|
|
100
|
+
* objects of one isolate), and `platform()`, the handle of the call inside, which throws when none is.
|
|
101
|
+
*/
|
|
102
|
+
export interface BrokerFacetEnv {
|
|
103
|
+
readonly SUBSTRAT_BROKER_NAME?: string;
|
|
104
|
+
platform(): BrokerPlatformHandle;
|
|
105
|
+
}
|
|
106
|
+
/** The facet's name inside a broker supervisor's object. One facet: the broker. */
|
|
107
|
+
export declare const BROKER_FACET = "broker";
|
|
108
|
+
/** The export a broker facet bundle's entry module names the class by. */
|
|
109
|
+
export declare const BROKER_FACET_CLASS = "BrokerFacet";
|
|
110
|
+
/**
|
|
111
|
+
* The broker's reads: calls that never accept, move or settle a message, so a supervisor runs them
|
|
112
|
+
* with no pre-arm and no `storage.sync()`, which would otherwise be a durable write per staff read.
|
|
113
|
+
* A method not listed here is pre-armed, whatever it does: the safe default for one added later.
|
|
114
|
+
*/
|
|
115
|
+
export declare const BROKER_READ_METHODS: ReadonlySet<string>;
|
|
116
|
+
/** The broker class's methods a supervisor answers itself, or that only it calls by name. */
|
|
117
|
+
export declare const BROKER_SUPERVISOR_OWNED: ReadonlySet<string>;
|
|
118
|
+
/**
|
|
119
|
+
* The broker's RPC surface, which a supervisor forwards and a facet answers: exactly what the class
|
|
120
|
+
* the platform supplies to a pushed vertical forwards (`SubstratDeliveryBrokerDO`), so a method added
|
|
121
|
+
* there is reachable on a supervised broker too, and nothing a broker keeps internal ever is. Read
|
|
122
|
+
* from the platform's own class, never from a bundle.
|
|
123
|
+
*/
|
|
124
|
+
export declare function brokerRpcMethods(): string[];
|
|
125
|
+
export {};
|
|
126
|
+
//# sourceMappingURL=broker-facet-seam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-facet-seam.d.ts","sourceRoot":"","sources":["../src/broker-facet-seam.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAIpI,0GAA0G;AAC1G,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,SAAkB,IAAI,uBAAuB;CAC9C;AAED,0EAA0E;AAC1E,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAkB,IAAI,4BAA4B;CACnD;AAED,gGAAgG;AAChG,UAAU,YAAY;IACpB,QAAQ,CAAC,GAAG,EAAE;QAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG;YAAE,OAAO,IAAI,OAAO,EAAE,CAAA;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MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IACvF,sGAAsG;IACtG,IAAI,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;CAC1F;AAED,uGAAuG;AACvG,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,OAAO;IAChD,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,yGAAyG;IACzG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,IAAI,oBAAoB,CAAC;CAClC;AAED,mFAAmF;AACnF,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CASlD,CAAC;AAEH,6FAA6F;AAC7F,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAgE,CAAC;AAEzH;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAK3C"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { servedBySupervisor } from './scope-facets.js';
|
|
2
|
+
import { SubstratDeliveryBrokerDO } from './supplied-delivery-broker.js';
|
|
3
|
+
/** What the forward fence answers with. A class, so a caller can tell it from the broker's own errors. */
|
|
4
|
+
export class BrokerFacetFenced extends Error {
|
|
5
|
+
name = 'BrokerFacetFenced';
|
|
6
|
+
}
|
|
7
|
+
/** What the rollback fence throws from the broker class's constructor. */
|
|
8
|
+
export class BrokerSupervisedFenced extends Error {
|
|
9
|
+
name = 'BrokerSupervisedFenced';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Does this object's own storage hold a broker's rows (the forward fence's question)? Any row in a
|
|
13
|
+
* `broker_*` table but `broker_schema`, which a broker writes when it wakes whether or not it was
|
|
14
|
+
* ever handed anything.
|
|
15
|
+
*/
|
|
16
|
+
export function holdsBrokerData(storage) {
|
|
17
|
+
const tables = storage.sql
|
|
18
|
+
.exec(`SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE 'broker\\_%' ESCAPE '\\' AND name <> 'broker_schema'`)
|
|
19
|
+
.toArray();
|
|
20
|
+
return tables.some(({ name }) => storage.sql.exec(`SELECT 1 FROM "${name.replaceAll('"', '""')}" LIMIT 1`).toArray().length > 0);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The rollback fence, run by the broker class as an object before it creates any table of its own.
|
|
24
|
+
* Read-only: one `sqlite_master` lookup per wake, and on an object no supervisor ever served it
|
|
25
|
+
* finds nothing and changes nothing.
|
|
26
|
+
*/
|
|
27
|
+
export function assertBrokerNotSupervised(storage) {
|
|
28
|
+
if (servedBySupervisor(storage)) {
|
|
29
|
+
throw new BrokerSupervisedFenced('this delivery broker runs as a facet: its rows are in the facet, not in this object. The broker ' +
|
|
30
|
+
'class will not serve it as an object, which would start empty and take every scope\'s backlog ' +
|
|
31
|
+
'again. Serve it through the broker supervisor again; moving a broker out of its facet is not built');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** The scope reads a broker's receivers make, and nothing else of the scope's surface. */
|
|
35
|
+
export const BROKER_SCOPE_READS = ['intentDeliveryState', 'eventLakeState'];
|
|
36
|
+
/** The facet's name inside a broker supervisor's object. One facet: the broker. */
|
|
37
|
+
export const BROKER_FACET = 'broker';
|
|
38
|
+
/** The export a broker facet bundle's entry module names the class by. */
|
|
39
|
+
export const BROKER_FACET_CLASS = 'BrokerFacet';
|
|
40
|
+
/**
|
|
41
|
+
* The broker's reads: calls that never accept, move or settle a message, so a supervisor runs them
|
|
42
|
+
* with no pre-arm and no `storage.sync()`, which would otherwise be a durable write per staff read.
|
|
43
|
+
* A method not listed here is pre-armed, whatever it does: the safe default for one added later.
|
|
44
|
+
*/
|
|
45
|
+
export const BROKER_READ_METHODS = new Set([
|
|
46
|
+
'marks',
|
|
47
|
+
'state',
|
|
48
|
+
'counts',
|
|
49
|
+
'deadLetters',
|
|
50
|
+
'deliveryQueue',
|
|
51
|
+
'deliveryComparison',
|
|
52
|
+
'waitOf',
|
|
53
|
+
'relayHops',
|
|
54
|
+
]);
|
|
55
|
+
/** The broker class's methods a supervisor answers itself, or that only it calls by name. */
|
|
56
|
+
export const BROKER_SUPERVISOR_OWNED = new Set(['constructor', 'fetch', 'alarm', 'supervisedCall']);
|
|
57
|
+
/**
|
|
58
|
+
* The broker's RPC surface, which a supervisor forwards and a facet answers: exactly what the class
|
|
59
|
+
* the platform supplies to a pushed vertical forwards (`SubstratDeliveryBrokerDO`), so a method added
|
|
60
|
+
* there is reachable on a supervised broker too, and nothing a broker keeps internal ever is. Read
|
|
61
|
+
* from the platform's own class, never from a bundle.
|
|
62
|
+
*/
|
|
63
|
+
export function brokerRpcMethods() {
|
|
64
|
+
const prototype = SubstratDeliveryBrokerDO.prototype;
|
|
65
|
+
return Object.getOwnPropertyNames(prototype).filter((name) => !BROKER_SUPERVISOR_OWNED.has(name) && typeof Object.getOwnPropertyDescriptor(prototype, name)?.value === 'function');
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=broker-facet-seam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broker-facet-seam.js","sourceRoot":"","sources":["../src/broker-facet-seam.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,0GAA0G;AAC1G,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACxB,IAAI,GAAG,m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,OAAO,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,SAAS,GAAG,wBAAwB,CAAC,SAAmB,CAAC;IAC/D,OAAO,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,MAAM,CACjD,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,OAAO,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,UAAU,CAC9H,CAAC;AACJ,CAAC"}
|
|
@@ -60,10 +60,10 @@ export declare const CONNECTION_SWEEP_FIRST_SPREAD_MS: number;
|
|
|
60
60
|
export declare function spreadOf(connectionId: string, spreadMs: number): number;
|
|
61
61
|
export interface ConnectionSweepConfig<Env> {
|
|
62
62
|
/**
|
|
63
|
-
* Whether this
|
|
64
|
-
*
|
|
63
|
+
* Whether this connection is swept by its object. Read on every alarm, so handing the sweep back
|
|
64
|
+
* needs no call to the object: it clears on its next wake.
|
|
65
65
|
*/
|
|
66
|
-
owned(env: Env): boolean;
|
|
66
|
+
owned(env: Env, connection: ConnectionSweepRef): boolean;
|
|
67
67
|
/**
|
|
68
68
|
* One run of one connection's sweep. CODE-TIME, as `defineKickCoalescerDO`'s `run`: the authority
|
|
69
69
|
* is the deployment's, so this object decides only WHEN. A throw is logged and the next run armed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-sweep-do.d.ts","sourceRoot":"","sources":["../src/connection-sweep-do.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AAEH,oFAAoF;AACpF,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CA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AE,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;CACxC;AAOD,wBAAgB,uBAAuB,CAAC,GAAG,EACzC,MAAM,EAAE,qBAAqB,CAAC,GAAG,CAAC,GACjC,KAAK,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,GAAG,KAAK,aAAa,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAwDnF"}
|
|
@@ -57,7 +57,7 @@ export function defineConnectionSweepDO(config) {
|
|
|
57
57
|
}
|
|
58
58
|
async alarm() {
|
|
59
59
|
const connection = await this.ctx.storage.get(KEY);
|
|
60
|
-
if (!connection || !config.owned(this.env)) {
|
|
60
|
+
if (!connection || !config.owned(this.env, connection)) {
|
|
61
61
|
await this.#clear();
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-sweep-do.js","sourceRoot":"","sources":["../src/connection-sweep-do.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAqDnD,iGAAiG;AACjG,MAAM,UAAU,mBAAmB,CAAC,YAAoB;IACtD,OAAO,cAAc,YAAY,EAAE,CAAC;AACtC,CAAC;AAED,gGAAgG;AAChG,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,GAAG,MAAM,CAAC;AAExD,kGAAkG;AAClG,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,GAAG,MAAM,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,GAAG,MAAM,CAAC;AAE3D,+FAA+F;AAC/F,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,+DAA+D;AAC/D,MAAM,UAAU,QAAQ,CAAC,YAAoB,EAAE,QAAgB;IAC7D,gGAAgG;IAChG,IAAI,CAAC,GAAG,UAAU,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,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,EAAE,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YAClI,CAAC;YACD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBACb,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;gBACpB,OAAO;YACT,CAAC;YACD,6FAA6F;YAC7F,8FAA8F;YAC9F,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;YAC1E,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;QAC3E,CAAC;QAED,KAAK,CAAC,MAAM;YACV,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACrC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -12,7 +12,7 @@ export type { RoleRow } from './directory-tenant-roles.js';
|
|
|
12
12
|
import { type BackfillLimits, type BackfillOwner, type BackfillStatus } from './directory-mirror-backfill.js';
|
|
13
13
|
import type { MirrorBackfillPass } from './directory-mirror.js';
|
|
14
14
|
import { type VerifyLimits, type VerifyOwner, type VerifyStatus } from './directory-mirror-verify.js';
|
|
15
|
-
import { type CutoverParityPage, type CutoverRow, type CutoverStatus, type TenantCutoverParity } from './directory-cutover.js';
|
|
15
|
+
import { type CutoverParityPage, type CutoverPreflight, type CutoverRow, type CutoverStatus, type TenantCutoverParity } from './directory-cutover.js';
|
|
16
16
|
import { type MemberTupleRow } from './directory-tenant-tuples.js';
|
|
17
17
|
export type { MemberTupleRow } from './directory-tenant-tuples.js';
|
|
18
18
|
import { type OrgRow } from './directory-tenant-orgs.js';
|
|
@@ -566,7 +566,9 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
566
566
|
private readonly kernelSql;
|
|
567
567
|
/** Settles once the constructor's #1764 backfill check has run (awaited by the tests). */
|
|
568
568
|
readonly backfillArmed: Promise<void>;
|
|
569
|
-
/**
|
|
569
|
+
/** After the directory commits, the pass can recover a failed handoff. */
|
|
570
|
+
private handOverTenantDueWork;
|
|
571
|
+
private handOverScopeCopy;
|
|
570
572
|
private armTenantDueWork;
|
|
571
573
|
private autoReapAt;
|
|
572
574
|
private armSnapshotReap;
|
|
@@ -636,6 +638,8 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
636
638
|
}): CutoverStatus | {
|
|
637
639
|
enabled: false;
|
|
638
640
|
};
|
|
641
|
+
/** Staff can read whether a flip on currently passes the gate without attempting it. */
|
|
642
|
+
directoryCutoverPreflight(tenantId: string): Promise<CutoverPreflight>;
|
|
639
643
|
/** The alarm's cut-over pass, now (staff, and tests): drains, flips off it can complete, registry records. */
|
|
640
644
|
settleDirectoryCutover(): Promise<CutoverStatus | {
|
|
641
645
|
enabled: false;
|
|
@@ -675,10 +679,10 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
675
679
|
private routeFlushing;
|
|
676
680
|
private routeFlushAgain;
|
|
677
681
|
/**
|
|
678
|
-
* How many
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
+
* How many calls are still in their directory work (see `ROUTE_KICK_EXEMPT`). A flush computes
|
|
683
|
+
* entries synchronously from the directory, so it only starts, and only reads a group of keys,
|
|
684
|
+
* while this is 0. Otherwise it could read a transaction before it commits and publish a snapshot
|
|
685
|
+
* of a write that later rolls back.
|
|
682
686
|
*/
|
|
683
687
|
routeCallDepth: number;
|
|
684
688
|
/**
|
|
@@ -1835,7 +1839,7 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
1835
1839
|
/** Point a scope's routing at the serving script its data now lives in (#286). False when a
|
|
1836
1840
|
* conditional move lost its compare-and-set: the host throws, since a refusal thrown here
|
|
1837
1841
|
* would cross the RPC boundary without its code. */
|
|
1838
|
-
setScopeServingRef(scopeId: string, servingRef: string | null, expectedErasureEpoch?: number, confirmMove?: ScopeCopyMoveConfirmation, audit?: AdminEntryInput): boolean
|
|
1842
|
+
setScopeServingRef(scopeId: string, servingRef: string | null, expectedErasureEpoch?: number, confirmMove?: ScopeCopyMoveConfirmation, audit?: AdminEntryInput): Promise<boolean>;
|
|
1839
1843
|
/** Move a fork's GC deadline forward, or pin it (`null`) — preview-and-snapshots.md §9. False
|
|
1840
1844
|
* when a reap has claimed the row (#3314): its deadline no longer decides anything. */
|
|
1841
1845
|
setScopeExpiresAt(scopeId: string, expiresAt: string | null, audit: AdminEntryInput): boolean;
|
|
@@ -1858,14 +1862,14 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
1858
1862
|
* `servingRef` moves the route in the same write, and `expectedServing` holds it to what the
|
|
1859
1863
|
* target lineage's serving script runs, read in this same synchronous transaction.
|
|
1860
1864
|
*/
|
|
1861
|
-
bindScopeVersionJudged(...args: Parameters<ControlPlaneDO['bindScopeVersion']>): boolean
|
|
1865
|
+
bindScopeVersionJudged(...args: Parameters<ControlPlaneDO['bindScopeVersion']>): Promise<boolean>;
|
|
1862
1866
|
/**
|
|
1863
1867
|
* The bind itself. A coordinator from before #3638 calls it directly; the current one calls
|
|
1864
1868
|
* `bindScopeVersionJudged` through `reply`, so an environment's checkpoint refusal reaches it typed.
|
|
1865
1869
|
*/
|
|
1866
1870
|
bindScopeVersion(scopeId: string, versionId: string, verticalSlug: string, expectedVersionId?: string | null, expectedErasureEpoch?: number, confirmMove?: ScopeCopyMoveConfirmation, servingRef?: string, expectedServing?: ExpectedServing, audit?: AdminEntryInput,
|
|
1867
1871
|
/** #3638: what this bind acknowledges if the scope is a named environment's preview. */
|
|
1868
|
-
environmentAcknowledge?: EnvironmentServeAcknowledgement): boolean
|
|
1872
|
+
environmentAcknowledge?: EnvironmentServeAcknowledgement): Promise<boolean>;
|
|
1869
1873
|
/** #2347: whether a lineage's serving script still runs the version a rebind was judged against. */
|
|
1870
1874
|
servesNow(expected: ExpectedServing): boolean;
|
|
1871
1875
|
/**
|
|
@@ -1921,7 +1925,8 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
1921
1925
|
scopeErasureEpoch(tenantId: string, scopeId: string): number;
|
|
1922
1926
|
/** The erasure claim (`SUBJECT_ERASURE_CLAIM_SQL`): false when the scope moved since the fence was read. */
|
|
1923
1927
|
claimSubjectErasure(tenantId: string, scopeId: string, fence: SubjectErasureFence): boolean;
|
|
1924
|
-
recordScopeScriptCopy(tenantId: string, scopeId: string, scriptRef: string, moveId: string, role?: ScopeCopyRole | null, loadStamp?: string | null, leaseMs?: number): 'recorded' | 'reaping' | 'missing' | 'invalid'
|
|
1928
|
+
recordScopeScriptCopy(tenantId: string, scopeId: string, scriptRef: string, moveId: string, role?: ScopeCopyRole | null, loadStamp?: string | null, leaseMs?: number): Promise<'recorded' | 'reaping' | 'missing' | 'invalid'>;
|
|
1929
|
+
private insertPendingScopeScriptCopy;
|
|
1925
1930
|
/**
|
|
1926
1931
|
* Record a pre-ledger copy, and its `backfillScopeCopy` audit row in the same unit (#1722): the row
|
|
1927
1932
|
* carries the erasure epoch read here, which the backfill orders erasures by, so an entry with no
|
|
@@ -1939,6 +1944,7 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
1939
1944
|
owner: string;
|
|
1940
1945
|
limit: number;
|
|
1941
1946
|
tenantId?: string;
|
|
1947
|
+
scopeId?: string;
|
|
1942
1948
|
}): ScopeScriptCopyRow[];
|
|
1943
1949
|
/** `HostAdmin.markScopeStoresFenced`: read and written in one synchronous step, so an unarchive is before or after. */
|
|
1944
1950
|
markScopeStoresFenced(tenantId: string, scopeId: string, whileTenantDeleting: boolean, audit?: AdminEntryInput, deadlines?: {
|
|
@@ -1948,9 +1954,10 @@ export declare class ControlPlaneDO extends DurableObject {
|
|
|
1948
1954
|
scopeStoresFencedAt(tenantId: string, scopeId: string): string | null;
|
|
1949
1955
|
/** #3314: `expiredBy` claims only while the expiry is set and due, in the claim's own write. */
|
|
1950
1956
|
beginScopeScriptReap(tenantId: string, scopeId: string, expiredBy?: string): 'claimed' | 'pending' | 'missing' | 'not-due';
|
|
1951
|
-
settleScopeScriptCopy(tenantId: string, scopeId: string, scriptRef: string, moveId: string, state: string, loadStamp: string | null, revision: string | null, claimedBy?: string): boolean
|
|
1957
|
+
settleScopeScriptCopy(tenantId: string, scopeId: string, scriptRef: string, moveId: string, state: string, loadStamp: string | null, revision: string | null, claimedBy?: string): Promise<boolean>;
|
|
1958
|
+
private settleScopeScriptCopyRow;
|
|
1952
1959
|
touchScopeScriptCopy(tenantId: string, scopeId: string, scriptRef: string, moveId: string): void;
|
|
1953
|
-
nextScopeCopyDue(tenantId: string, now: string): string | null;
|
|
1960
|
+
nextScopeCopyDue(tenantId: string, now: string, scopeId?: string): string | null;
|
|
1954
1961
|
listDueScopeCopyTenants(input: {
|
|
1955
1962
|
after: string;
|
|
1956
1963
|
by: string;
|