@lunora/do 1.0.0-alpha.290 → 1.0.0-alpha.291
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/index.d.mts
CHANGED
|
@@ -1909,6 +1909,13 @@ declare abstract class ShardDO {
|
|
|
1909
1909
|
* alongside {@link ShardDO.pendingChangedTables}.
|
|
1910
1910
|
*/
|
|
1911
1911
|
private pendingChangedKeys;
|
|
1912
|
+
/**
|
|
1913
|
+
* D1 bookmarks the `.global()` writes behind {@link ShardDO.pendingChangedTables} reported, recorded with
|
|
1914
|
+
* their tables by {@link ShardDO.recordGlobalWrite} so they travel with them however dispatches interleave.
|
|
1915
|
+
*/
|
|
1916
|
+
private pendingChangedBookmarks;
|
|
1917
|
+
/** Coalesced twin of {@link ShardDO.pendingChangedBookmarks}; see {@link refreshReadBookmark}. */
|
|
1918
|
+
private pendingRefreshBookmarks;
|
|
1912
1919
|
/** Coalesced twin of {@link ShardDO.pendingChangedKeys} for the in-flight refresh pass. */
|
|
1913
1920
|
private pendingRefreshKeys;
|
|
1914
1921
|
/**
|
|
@@ -3762,8 +3769,14 @@ declare abstract class ShardDO {
|
|
|
3762
3769
|
* fields from a deferred (`waitUntil`) or concurrently-interleaved context.
|
|
3763
3770
|
* A refresh runs while the write that triggered it still owns those fields,
|
|
3764
3771
|
* so reading `ip` there would hand every subscriber the MUTATING caller's IP.
|
|
3772
|
+
*
|
|
3773
|
+
* `refreshBookmark` is the D1 bookmark a refresh's `.global()` reads must start at,
|
|
3774
|
+
* threaded by value for the same reason (see {@link refreshReadBookmark}). The
|
|
3775
|
+
* inbound bookmark on the instance belongs to whichever dispatch holds it now,
|
|
3776
|
+
* not to the write that scheduled this run. `undefined` keeps the reader's own
|
|
3777
|
+
* choice.
|
|
3765
3778
|
*/
|
|
3766
|
-
protected executeSubscription(_functionPath: string, _args: Record<string, unknown>, _identity?: SubscriptionIdentity): Promise<SubscriptionOutcome | null>;
|
|
3779
|
+
protected executeSubscription(_functionPath: string, _args: Record<string, unknown>, _identity?: SubscriptionIdentity, _refreshBookmark?: string): Promise<SubscriptionOutcome | null>;
|
|
3767
3780
|
/**
|
|
3768
3781
|
* Resolve a named shape to its concrete query plan for `identity`. The base
|
|
3769
3782
|
* class has no shape registry, so it returns `undefined` — partial
|
|
@@ -4334,6 +4347,12 @@ declare abstract class ShardDO {
|
|
|
4334
4347
|
* `flushChangedTables` can re-run only the affected subscriptions.
|
|
4335
4348
|
*/
|
|
4336
4349
|
protected recordChangedTable(table: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): void;
|
|
4350
|
+
/**
|
|
4351
|
+
* A row the `.global()` writer stored, reported by the writer itself (its `onWrite`), so a write a
|
|
4352
|
+
* trigger made inside it is announced too: the shard engine's broadcast only sees the writes it issued.
|
|
4353
|
+
* `bookmark` is the D1 bookmark the writer's session held after the write; the refresh reads at it.
|
|
4354
|
+
*/
|
|
4355
|
+
protected recordGlobalWrite(table: string, bookmark: string | undefined): void;
|
|
4337
4356
|
/**
|
|
4338
4357
|
* Per-batch progress hook for the codegen subclass's data-migration runner
|
|
4339
4358
|
* (wired via `runDataMigration`'s `onBatch`). The runner persists progress to
|
|
@@ -5044,6 +5063,13 @@ declare abstract class ShardDO {
|
|
|
5044
5063
|
* bearer check above.
|
|
5045
5064
|
*/
|
|
5046
5065
|
private handleRunAs;
|
|
5066
|
+
/**
|
|
5067
|
+
* Drain the tables a dispatch outside `/rpc` recorded, however it ended: a `.global()` write
|
|
5068
|
+
* reached D1 before the throw and is not undone by the Durable Object's rollback, and a
|
|
5069
|
+
* rolled-back table only costs a re-read of committed state. A flush failure is recorded,
|
|
5070
|
+
* never thrown, so it cannot replace the dispatch's own outcome.
|
|
5071
|
+
*/
|
|
5072
|
+
private flushAfterDispatch;
|
|
5047
5073
|
/**
|
|
5048
5074
|
* Resolve a declared workflow's runtime binding handle. Looks the
|
|
5049
5075
|
* `exportName` up in {@link workflowsMetadata} (the codegen subclass's
|
|
@@ -5835,6 +5861,12 @@ declare abstract class ShardDO {
|
|
|
5835
5861
|
* shortly after.
|
|
5836
5862
|
*/
|
|
5837
5863
|
private flushChangedTables;
|
|
5864
|
+
/**
|
|
5865
|
+
* Merge `changed` into the coalesced refresh state and start the drain unless one is running.
|
|
5866
|
+
* Shared by a local write's flush and the global poll tick, which learns of another shard's
|
|
5867
|
+
* `.global()` write, so both coalesce into one pass.
|
|
5868
|
+
*/
|
|
5869
|
+
private queueSubscriptionRefresh;
|
|
5838
5870
|
/**
|
|
5839
5871
|
* Drain {@link ShardDO.pendingRefreshTables} one coalesced batch at a time
|
|
5840
5872
|
* until it is empty, then release the {@link ShardDO.refreshInFlight} gate.
|
|
@@ -6462,12 +6494,26 @@ declare abstract class ShardDO {
|
|
|
6462
6494
|
* `cursorOnly` says the caller has already committed to reading everything
|
|
6463
6495
|
* this pass and wants only the cursor — see the contract on
|
|
6464
6496
|
* `DatabaseWriterLike.cdcChangedTables`.
|
|
6497
|
+
*
|
|
6498
|
+
* `bookmark` is the D1 bookmark the changelog read's session held: a read at
|
|
6499
|
+
* it sees every write the answer reports, so the subscription refresh the
|
|
6500
|
+
* answer schedules reads at it. Absent on a backend that reports none.
|
|
6465
6501
|
*/
|
|
6466
6502
|
protected readGlobalChangedTables(_sinceSeq: number, _cursorOnly?: boolean): Promise<{
|
|
6503
|
+
bookmark?: string;
|
|
6467
6504
|
cursor: number;
|
|
6468
6505
|
floor?: number;
|
|
6469
6506
|
tables: string[];
|
|
6470
6507
|
} | undefined>;
|
|
6508
|
+
/**
|
|
6509
|
+
* The `.global()` tables whose writes by other shards this one learns of from the global
|
|
6510
|
+
* changelog on its poll tick. Empty without a changelog (CDC off): there is then nothing a tick
|
|
6511
|
+
* could narrow by, and re-running every global-reading live query each tick is not paid for
|
|
6512
|
+
* silently, so such a query sees another shard's write only when its own shard writes the
|
|
6513
|
+
* table or the socket resubscribes. The codegen subclass overrides it for an app with
|
|
6514
|
+
* `.global()` tables.
|
|
6515
|
+
*/
|
|
6516
|
+
protected polledGlobalTables(): ReadonlySet<string>;
|
|
6471
6517
|
/**
|
|
6472
6518
|
* The two answers a `/rpc` can earn between the replica gate and
|
|
6473
6519
|
* `beginDispatch`: a reserved admin RPC (served under its own scope and
|
|
@@ -6582,6 +6628,22 @@ declare abstract class ShardDO {
|
|
|
6582
6628
|
* are dropped in passing (mirrors {@link ShardDO.pokeShapeSubscribers}).
|
|
6583
6629
|
*/
|
|
6584
6630
|
private pollGlobalShapes;
|
|
6631
|
+
/**
|
|
6632
|
+
* How many live queries on `sockets` read a polled `.global()` table, which is what keeps the poll
|
|
6633
|
+
* armed for them. A subscription with no memo counts: after hibernation nothing records what it
|
|
6634
|
+
* read, and the next tick's refresh re-runs it and records that, so a shard holding only local
|
|
6635
|
+
* queries stops polling one tick after waking.
|
|
6636
|
+
*/
|
|
6637
|
+
private countGlobalQueryReaders;
|
|
6638
|
+
/**
|
|
6639
|
+
* Re-run the live queries that read a `.global()` table the changelog says another writer moved,
|
|
6640
|
+
* through the same coalesced refresh a local write schedules. A full pass treats every polled
|
|
6641
|
+
* table as moved. The run reads at the changelog read's own bookmark, which covers every write it
|
|
6642
|
+
* reported; without one it reads at the primary. This shard's own writes come back here too (the
|
|
6643
|
+
* changelog does not name the writer), so each costs its subscribers one more run, whose unchanged
|
|
6644
|
+
* result is not pushed again.
|
|
6645
|
+
*/
|
|
6646
|
+
private refreshFromGlobalPoll;
|
|
6585
6647
|
/**
|
|
6586
6648
|
* Refresh one socket's `.global()`-table shapes, containing per-shape
|
|
6587
6649
|
* failures so a single throw never aborts the poll tick (and with it the
|
package/dist/index.d.ts
CHANGED
|
@@ -1909,6 +1909,13 @@ declare abstract class ShardDO {
|
|
|
1909
1909
|
* alongside {@link ShardDO.pendingChangedTables}.
|
|
1910
1910
|
*/
|
|
1911
1911
|
private pendingChangedKeys;
|
|
1912
|
+
/**
|
|
1913
|
+
* D1 bookmarks the `.global()` writes behind {@link ShardDO.pendingChangedTables} reported, recorded with
|
|
1914
|
+
* their tables by {@link ShardDO.recordGlobalWrite} so they travel with them however dispatches interleave.
|
|
1915
|
+
*/
|
|
1916
|
+
private pendingChangedBookmarks;
|
|
1917
|
+
/** Coalesced twin of {@link ShardDO.pendingChangedBookmarks}; see {@link refreshReadBookmark}. */
|
|
1918
|
+
private pendingRefreshBookmarks;
|
|
1912
1919
|
/** Coalesced twin of {@link ShardDO.pendingChangedKeys} for the in-flight refresh pass. */
|
|
1913
1920
|
private pendingRefreshKeys;
|
|
1914
1921
|
/**
|
|
@@ -3762,8 +3769,14 @@ declare abstract class ShardDO {
|
|
|
3762
3769
|
* fields from a deferred (`waitUntil`) or concurrently-interleaved context.
|
|
3763
3770
|
* A refresh runs while the write that triggered it still owns those fields,
|
|
3764
3771
|
* so reading `ip` there would hand every subscriber the MUTATING caller's IP.
|
|
3772
|
+
*
|
|
3773
|
+
* `refreshBookmark` is the D1 bookmark a refresh's `.global()` reads must start at,
|
|
3774
|
+
* threaded by value for the same reason (see {@link refreshReadBookmark}). The
|
|
3775
|
+
* inbound bookmark on the instance belongs to whichever dispatch holds it now,
|
|
3776
|
+
* not to the write that scheduled this run. `undefined` keeps the reader's own
|
|
3777
|
+
* choice.
|
|
3765
3778
|
*/
|
|
3766
|
-
protected executeSubscription(_functionPath: string, _args: Record<string, unknown>, _identity?: SubscriptionIdentity): Promise<SubscriptionOutcome | null>;
|
|
3779
|
+
protected executeSubscription(_functionPath: string, _args: Record<string, unknown>, _identity?: SubscriptionIdentity, _refreshBookmark?: string): Promise<SubscriptionOutcome | null>;
|
|
3767
3780
|
/**
|
|
3768
3781
|
* Resolve a named shape to its concrete query plan for `identity`. The base
|
|
3769
3782
|
* class has no shape registry, so it returns `undefined` — partial
|
|
@@ -4334,6 +4347,12 @@ declare abstract class ShardDO {
|
|
|
4334
4347
|
* `flushChangedTables` can re-run only the affected subscriptions.
|
|
4335
4348
|
*/
|
|
4336
4349
|
protected recordChangedTable(table: string, indexKeys?: ReadonlyArray<IndexKeyEntry>): void;
|
|
4350
|
+
/**
|
|
4351
|
+
* A row the `.global()` writer stored, reported by the writer itself (its `onWrite`), so a write a
|
|
4352
|
+
* trigger made inside it is announced too: the shard engine's broadcast only sees the writes it issued.
|
|
4353
|
+
* `bookmark` is the D1 bookmark the writer's session held after the write; the refresh reads at it.
|
|
4354
|
+
*/
|
|
4355
|
+
protected recordGlobalWrite(table: string, bookmark: string | undefined): void;
|
|
4337
4356
|
/**
|
|
4338
4357
|
* Per-batch progress hook for the codegen subclass's data-migration runner
|
|
4339
4358
|
* (wired via `runDataMigration`'s `onBatch`). The runner persists progress to
|
|
@@ -5044,6 +5063,13 @@ declare abstract class ShardDO {
|
|
|
5044
5063
|
* bearer check above.
|
|
5045
5064
|
*/
|
|
5046
5065
|
private handleRunAs;
|
|
5066
|
+
/**
|
|
5067
|
+
* Drain the tables a dispatch outside `/rpc` recorded, however it ended: a `.global()` write
|
|
5068
|
+
* reached D1 before the throw and is not undone by the Durable Object's rollback, and a
|
|
5069
|
+
* rolled-back table only costs a re-read of committed state. A flush failure is recorded,
|
|
5070
|
+
* never thrown, so it cannot replace the dispatch's own outcome.
|
|
5071
|
+
*/
|
|
5072
|
+
private flushAfterDispatch;
|
|
5047
5073
|
/**
|
|
5048
5074
|
* Resolve a declared workflow's runtime binding handle. Looks the
|
|
5049
5075
|
* `exportName` up in {@link workflowsMetadata} (the codegen subclass's
|
|
@@ -5835,6 +5861,12 @@ declare abstract class ShardDO {
|
|
|
5835
5861
|
* shortly after.
|
|
5836
5862
|
*/
|
|
5837
5863
|
private flushChangedTables;
|
|
5864
|
+
/**
|
|
5865
|
+
* Merge `changed` into the coalesced refresh state and start the drain unless one is running.
|
|
5866
|
+
* Shared by a local write's flush and the global poll tick, which learns of another shard's
|
|
5867
|
+
* `.global()` write, so both coalesce into one pass.
|
|
5868
|
+
*/
|
|
5869
|
+
private queueSubscriptionRefresh;
|
|
5838
5870
|
/**
|
|
5839
5871
|
* Drain {@link ShardDO.pendingRefreshTables} one coalesced batch at a time
|
|
5840
5872
|
* until it is empty, then release the {@link ShardDO.refreshInFlight} gate.
|
|
@@ -6462,12 +6494,26 @@ declare abstract class ShardDO {
|
|
|
6462
6494
|
* `cursorOnly` says the caller has already committed to reading everything
|
|
6463
6495
|
* this pass and wants only the cursor — see the contract on
|
|
6464
6496
|
* `DatabaseWriterLike.cdcChangedTables`.
|
|
6497
|
+
*
|
|
6498
|
+
* `bookmark` is the D1 bookmark the changelog read's session held: a read at
|
|
6499
|
+
* it sees every write the answer reports, so the subscription refresh the
|
|
6500
|
+
* answer schedules reads at it. Absent on a backend that reports none.
|
|
6465
6501
|
*/
|
|
6466
6502
|
protected readGlobalChangedTables(_sinceSeq: number, _cursorOnly?: boolean): Promise<{
|
|
6503
|
+
bookmark?: string;
|
|
6467
6504
|
cursor: number;
|
|
6468
6505
|
floor?: number;
|
|
6469
6506
|
tables: string[];
|
|
6470
6507
|
} | undefined>;
|
|
6508
|
+
/**
|
|
6509
|
+
* The `.global()` tables whose writes by other shards this one learns of from the global
|
|
6510
|
+
* changelog on its poll tick. Empty without a changelog (CDC off): there is then nothing a tick
|
|
6511
|
+
* could narrow by, and re-running every global-reading live query each tick is not paid for
|
|
6512
|
+
* silently, so such a query sees another shard's write only when its own shard writes the
|
|
6513
|
+
* table or the socket resubscribes. The codegen subclass overrides it for an app with
|
|
6514
|
+
* `.global()` tables.
|
|
6515
|
+
*/
|
|
6516
|
+
protected polledGlobalTables(): ReadonlySet<string>;
|
|
6471
6517
|
/**
|
|
6472
6518
|
* The two answers a `/rpc` can earn between the replica gate and
|
|
6473
6519
|
* `beginDispatch`: a reserved admin RPC (served under its own scope and
|
|
@@ -6582,6 +6628,22 @@ declare abstract class ShardDO {
|
|
|
6582
6628
|
* are dropped in passing (mirrors {@link ShardDO.pokeShapeSubscribers}).
|
|
6583
6629
|
*/
|
|
6584
6630
|
private pollGlobalShapes;
|
|
6631
|
+
/**
|
|
6632
|
+
* How many live queries on `sockets` read a polled `.global()` table, which is what keeps the poll
|
|
6633
|
+
* armed for them. A subscription with no memo counts: after hibernation nothing records what it
|
|
6634
|
+
* read, and the next tick's refresh re-runs it and records that, so a shard holding only local
|
|
6635
|
+
* queries stops polling one tick after waking.
|
|
6636
|
+
*/
|
|
6637
|
+
private countGlobalQueryReaders;
|
|
6638
|
+
/**
|
|
6639
|
+
* Re-run the live queries that read a `.global()` table the changelog says another writer moved,
|
|
6640
|
+
* through the same coalesced refresh a local write schedules. A full pass treats every polled
|
|
6641
|
+
* table as moved. The run reads at the changelog read's own bookmark, which covers every write it
|
|
6642
|
+
* reported; without one it reads at the primary. This shard's own writes come back here too (the
|
|
6643
|
+
* changelog does not name the writer), so each costs its subscribers one more run, whose unchanged
|
|
6644
|
+
* result is not pushed again.
|
|
6645
|
+
*/
|
|
6646
|
+
private refreshFromGlobalPoll;
|
|
6585
6647
|
/**
|
|
6586
6648
|
* Refresh one socket's `.global()`-table shapes, containing per-shape
|
|
6587
6649
|
* failures so a single throw never aborts the poll tick (and with it the
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AdminRevocationDO as a}from"./packem_shared/AdminRevocationDO-DHjoZWfF.mjs";import{installDeliveryFence as t}from"./packem_shared/installDeliveryFence-B6M9KOnb.mjs";import{MERGED_ROLES as S,mergeDurableObjects as i,roleNamespace as l}from"./packem_shared/MERGED_ROLES-BAMAmIcW.mjs";import{serveRelationFanout as n}from"./packem_shared/serveRelationFanout-DcSjzAZv.mjs";import{SESSION_DO_TTL_DEFAULT as d,SessionDO as p}from"./packem_shared/SESSION_DO_TTL_DEFAULT-DSvTwRjc.mjs";import{ROOT_DO_SIZE_WARN_BYTES as D,ROOT_SHARD_NAME as O,ShardDO as E}from"./packem_shared/ROOT_DO_SIZE_WARN_BYTES-
|
|
1
|
+
import{AdminRevocationDO as a}from"./packem_shared/AdminRevocationDO-DHjoZWfF.mjs";import{installDeliveryFence as t}from"./packem_shared/installDeliveryFence-B6M9KOnb.mjs";import{MERGED_ROLES as S,mergeDurableObjects as i,roleNamespace as l}from"./packem_shared/MERGED_ROLES-BAMAmIcW.mjs";import{serveRelationFanout as n}from"./packem_shared/serveRelationFanout-DcSjzAZv.mjs";import{SESSION_DO_TTL_DEFAULT as d,SessionDO as p}from"./packem_shared/SESSION_DO_TTL_DEFAULT-DSvTwRjc.mjs";import{ROOT_DO_SIZE_WARN_BYTES as D,ROOT_SHARD_NAME as O,ShardDO as E}from"./packem_shared/ROOT_DO_SIZE_WARN_BYTES-SCKW1DmN.mjs";import{SHARD_REGISTRY_DO_NAME as h,ShardRegistryDO as x,hostedShardRegistry as f}from"./packem_shared/SHARD_REGISTRY_DO_NAME-Dbh8JQJQ.mjs";import{createStableIdFactory as A,createStableRandomFactory as I}from"./packem_shared/createStableIdFactory-DPDT_chw.mjs";import{createShardAlarms as b,createShardDirectory as M,createShardHost as N,createShardKvStore as g,createShardPlatform as y,createSocketHost as k,createWorkerPlatform as F}from"@lunora/platform-cloudflare";import{REPROJECTION_MIGRATION_PREFIX as L,UNVOUCHABLE_DEP as v,applyCdcChanges as H,assertShapeShardable as P,backfillSearchIndexes as j,backfillVectorIndexes as U,buildReprojectionMigration as w,clearMemoryTables as G,countLegacyRows as V,createReadFootprint as B,createShardCtxDb as W,exportShardRows as Y,importShardRows as J,isSourceDue as K,markUnvouchableReads as X,pullExternalSourceIncrementalTick as Z,pullExternalSourceTick as q,reprojectionMigrationId as z,reprojectionTables as Q,runDataMigration as $,runShardMigrations as ee,subscriptionListDeltas as re}from"@lunora/shard-engine";import{A as oe}from"./packem_shared/admin-token-DrufJIZV.mjs";export{oe as ADMIN_REVOCATION_DO_NAME,a as AdminRevocationDO,S as MERGED_ROLES,L as REPROJECTION_MIGRATION_PREFIX,D as ROOT_DO_SIZE_WARN_BYTES,O as ROOT_SHARD_NAME,d as SESSION_DO_TTL_DEFAULT,h as SHARD_REGISTRY_DO_NAME,p as SessionDO,E as ShardDO,x as ShardRegistryDO,v as UNVOUCHABLE_DEP,H as applyCdcChanges,P as assertShapeShardable,j as backfillSearchIndexes,U as backfillVectorIndexes,w as buildReprojectionMigration,G as clearMemoryTables,V as countLegacyRows,B as createReadFootprint,b as createShardAlarms,W as createShardCtxDb,M as createShardDirectory,N as createShardHost,g as createShardKvStore,y as createShardPlatform,k as createSocketHost,A as createStableIdFactory,I as createStableRandomFactory,F as createWorkerPlatform,Y as exportShardRows,f as hostedShardRegistry,J as importShardRows,t as installDeliveryFence,K as isSourceDue,X as markUnvouchableReads,i as mergeDurableObjects,Z as pullExternalSourceIncrementalTick,q as pullExternalSourceTick,z as reprojectionMigrationId,Q as reprojectionTables,l as roleNamespace,$ as runDataMigration,ee as runShardMigrations,n as serveRelationFanout,re as subscriptionListDeltas};
|