@lunora/do 1.0.0-alpha.298 → 1.0.0-alpha.299
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
|
@@ -2286,6 +2286,27 @@ declare abstract class ShardDO {
|
|
|
2286
2286
|
* hibernation/restart — drives the `unused_index` runtime advisory.
|
|
2287
2287
|
*/
|
|
2288
2288
|
private readonly usedIndexes;
|
|
2289
|
+
/**
|
|
2290
|
+
* Successful request-log rows not yet written, in dispatch order, each already
|
|
2291
|
+
* deploy-attributed and timestamped at its dispatch. Written as one batch once it
|
|
2292
|
+
* holds `min(metricsFlushEvery(), REQUEST_LOG_MAX_BATCH)` entries or
|
|
2293
|
+
* {@link REQUEST_LOG_FLUSH_DELAY_MS} after the first entry arrived, whichever
|
|
2294
|
+
* comes first, and before any error or container row and every read of
|
|
2295
|
+
* `__lunora_reqlog__` (see {@link ShardDO.flushRequestLog}). So a success row is
|
|
2296
|
+
* written at most one batch or one second after its dispatch; an instance that
|
|
2297
|
+
* dies inside that window loses those SUCCESSFUL rows. Errors are never buffered.
|
|
2298
|
+
*
|
|
2299
|
+
* A live Logs/Issues view in production catches up on the next write-flush or
|
|
2300
|
+
* error, as it always has (a success never marked the table changed); a
|
|
2301
|
+
* success it re-reads may still sit here until its batch is written. Writing
|
|
2302
|
+
* through while such a view is open would need to know one is: the socket
|
|
2303
|
+
* table index keeps no per-table count, and those views are admin-wildcard
|
|
2304
|
+
* memos that match every table, so finding one is a scan over every socket
|
|
2305
|
+
* per dispatch.
|
|
2306
|
+
*/
|
|
2307
|
+
private readonly pendingRequestLog;
|
|
2308
|
+
/** Armed when the first entry enters an empty {@link ShardDO.pendingRequestLog}; any write of the buffer clears it. */
|
|
2309
|
+
private requestLogTimer;
|
|
2289
2310
|
/**
|
|
2290
2311
|
* Per-function counters and the coalesced durable delta. Built from thunks,
|
|
2291
2312
|
* so this field initializer can run before the constructor assigns `env`
|
|
@@ -4433,6 +4454,13 @@ declare abstract class ShardDO {
|
|
|
4433
4454
|
* as this request's. The dispatch path re-pins its own afterwards.
|
|
4434
4455
|
*/
|
|
4435
4456
|
protected restoreRequestScope(scope: RequestScope): void;
|
|
4457
|
+
/**
|
|
4458
|
+
* Write the buffered successful rows so a read of `__lunora_reqlog__` is never
|
|
4459
|
+
* stale: every reader of the table calls this first, as `flushUnwrittenMetrics`
|
|
4460
|
+
* does for the metric tables. Like every success write it does not mark the
|
|
4461
|
+
* table changed; other live views catch up on the next write-flush.
|
|
4462
|
+
*/
|
|
4463
|
+
protected flushRequestLog(): void;
|
|
4436
4464
|
/** The `connect` control frame: verify a pending socket, send its identity, and fire `onConnect` once. */
|
|
4437
4465
|
private handleConnectFrame;
|
|
4438
4466
|
/** A live-query `subscribe` frame: gate it, register it on the socket, and seed it. */
|
|
@@ -5312,7 +5340,7 @@ declare abstract class ShardDO {
|
|
|
5312
5340
|
* Best-effort, exactly like `recordFunctionCall`'s durable upsert: a SQL
|
|
5313
5341
|
* failure (e.g. a test double without a `sql` handle) must NEVER turn a
|
|
5314
5342
|
* served request into a failed one, so it is swallowed. Args are redacted
|
|
5315
|
-
* inside `
|
|
5343
|
+
* inside `buildRequestLogRow` so a raw value never reaches the table.
|
|
5316
5344
|
*
|
|
5317
5345
|
* The correlated fields all come from data the dispatch already holds, with
|
|
5318
5346
|
* no extra hot-path bookkeeping. `tablesWritten` is snapshotted from
|
|
@@ -5352,6 +5380,45 @@ declare abstract class ShardDO {
|
|
|
5352
5380
|
* `LUNORA_REQUEST_LOG_EMIT` so a hot shard doesn't emit a line per call.
|
|
5353
5381
|
*/
|
|
5354
5382
|
private persistRequestLog;
|
|
5383
|
+
/**
|
|
5384
|
+
* Write every buffered request-log row. Best-effort and never retried: the
|
|
5385
|
+
* buffer is emptied before the write, so a failing SQL handle drops the batch
|
|
5386
|
+
* instead of failing the request or growing the buffer forever. The exception is
|
|
5387
|
+
* a host refusal, see {@link ShardDO.keepRefusedRequestLogRows}.
|
|
5388
|
+
* @returns whether refused rows were put back; the newest row is then among them
|
|
5389
|
+
*/
|
|
5390
|
+
private writePendingRequestLog;
|
|
5391
|
+
/**
|
|
5392
|
+
* Re-run the live Logs/Issues subscriptions after a retried error row landed.
|
|
5393
|
+
* Merged straight into the refresh state, as the global poll tick does, rather
|
|
5394
|
+
* than through `recordChangedTable` + `flushChangedTables`: this can run from the
|
|
5395
|
+
* timer or inside another dispatch, and draining the shared changed-table set
|
|
5396
|
+
* there would take an in-flight dispatch's writes from it. Never throws.
|
|
5397
|
+
*/
|
|
5398
|
+
private refreshForRetriedErrorRows;
|
|
5399
|
+
/**
|
|
5400
|
+
* Put rows the host refused with `SHARD_UNAVAILABLE` back at the front of the
|
|
5401
|
+
* buffer and retry them on the timer. The Node host refuses SQL from any task but
|
|
5402
|
+
* the one holding an open transaction, so a flush that lands while a mutation
|
|
5403
|
+
* awaits (the timer, a query's count flush, a read) would otherwise lose the
|
|
5404
|
+
* batch. Nothing of a refused row was written, so retrying it cannot duplicate.
|
|
5405
|
+
*
|
|
5406
|
+
* The buffer stays bounded at {@link REQUEST_LOG_MAX_BATCH}: past it, the oldest
|
|
5407
|
+
* rows are dropped, successes before errors, and an error row is never dropped
|
|
5408
|
+
* while a success remains. The retry runs only while rows are buffered, and any
|
|
5409
|
+
* dispatch arriving meanwhile flushes as usual.
|
|
5410
|
+
*/
|
|
5411
|
+
private keepRefusedRequestLogRows;
|
|
5412
|
+
/**
|
|
5413
|
+
* Arm the one-shot {@link REQUEST_LOG_FLUSH_DELAY_MS} write of the buffer, unless
|
|
5414
|
+
* one is already pending: a burst arms one timer, never one per dispatch. The
|
|
5415
|
+
* write runs outside any request, so it swallows everything rather than throw
|
|
5416
|
+
* into the event loop. Like every success write it does not mark the table
|
|
5417
|
+
* changed; only landing an error row the host refused earlier refreshes (see
|
|
5418
|
+
* {@link ShardDO.refreshForRetriedErrorRows}). On Cloudflare a pending timer keeps the instance from hibernating
|
|
5419
|
+
* until it fires, at most this one delay per burst.
|
|
5420
|
+
*/
|
|
5421
|
+
private armRequestLogTimer;
|
|
5355
5422
|
/**
|
|
5356
5423
|
* Stamp the deploying Worker's version onto a request-log entry, so the
|
|
5357
5424
|
* durable row AND the emitted Workers-Logs event both carry it.
|
package/dist/index.d.ts
CHANGED
|
@@ -2286,6 +2286,27 @@ declare abstract class ShardDO {
|
|
|
2286
2286
|
* hibernation/restart — drives the `unused_index` runtime advisory.
|
|
2287
2287
|
*/
|
|
2288
2288
|
private readonly usedIndexes;
|
|
2289
|
+
/**
|
|
2290
|
+
* Successful request-log rows not yet written, in dispatch order, each already
|
|
2291
|
+
* deploy-attributed and timestamped at its dispatch. Written as one batch once it
|
|
2292
|
+
* holds `min(metricsFlushEvery(), REQUEST_LOG_MAX_BATCH)` entries or
|
|
2293
|
+
* {@link REQUEST_LOG_FLUSH_DELAY_MS} after the first entry arrived, whichever
|
|
2294
|
+
* comes first, and before any error or container row and every read of
|
|
2295
|
+
* `__lunora_reqlog__` (see {@link ShardDO.flushRequestLog}). So a success row is
|
|
2296
|
+
* written at most one batch or one second after its dispatch; an instance that
|
|
2297
|
+
* dies inside that window loses those SUCCESSFUL rows. Errors are never buffered.
|
|
2298
|
+
*
|
|
2299
|
+
* A live Logs/Issues view in production catches up on the next write-flush or
|
|
2300
|
+
* error, as it always has (a success never marked the table changed); a
|
|
2301
|
+
* success it re-reads may still sit here until its batch is written. Writing
|
|
2302
|
+
* through while such a view is open would need to know one is: the socket
|
|
2303
|
+
* table index keeps no per-table count, and those views are admin-wildcard
|
|
2304
|
+
* memos that match every table, so finding one is a scan over every socket
|
|
2305
|
+
* per dispatch.
|
|
2306
|
+
*/
|
|
2307
|
+
private readonly pendingRequestLog;
|
|
2308
|
+
/** Armed when the first entry enters an empty {@link ShardDO.pendingRequestLog}; any write of the buffer clears it. */
|
|
2309
|
+
private requestLogTimer;
|
|
2289
2310
|
/**
|
|
2290
2311
|
* Per-function counters and the coalesced durable delta. Built from thunks,
|
|
2291
2312
|
* so this field initializer can run before the constructor assigns `env`
|
|
@@ -4433,6 +4454,13 @@ declare abstract class ShardDO {
|
|
|
4433
4454
|
* as this request's. The dispatch path re-pins its own afterwards.
|
|
4434
4455
|
*/
|
|
4435
4456
|
protected restoreRequestScope(scope: RequestScope): void;
|
|
4457
|
+
/**
|
|
4458
|
+
* Write the buffered successful rows so a read of `__lunora_reqlog__` is never
|
|
4459
|
+
* stale: every reader of the table calls this first, as `flushUnwrittenMetrics`
|
|
4460
|
+
* does for the metric tables. Like every success write it does not mark the
|
|
4461
|
+
* table changed; other live views catch up on the next write-flush.
|
|
4462
|
+
*/
|
|
4463
|
+
protected flushRequestLog(): void;
|
|
4436
4464
|
/** The `connect` control frame: verify a pending socket, send its identity, and fire `onConnect` once. */
|
|
4437
4465
|
private handleConnectFrame;
|
|
4438
4466
|
/** A live-query `subscribe` frame: gate it, register it on the socket, and seed it. */
|
|
@@ -5312,7 +5340,7 @@ declare abstract class ShardDO {
|
|
|
5312
5340
|
* Best-effort, exactly like `recordFunctionCall`'s durable upsert: a SQL
|
|
5313
5341
|
* failure (e.g. a test double without a `sql` handle) must NEVER turn a
|
|
5314
5342
|
* served request into a failed one, so it is swallowed. Args are redacted
|
|
5315
|
-
* inside `
|
|
5343
|
+
* inside `buildRequestLogRow` so a raw value never reaches the table.
|
|
5316
5344
|
*
|
|
5317
5345
|
* The correlated fields all come from data the dispatch already holds, with
|
|
5318
5346
|
* no extra hot-path bookkeeping. `tablesWritten` is snapshotted from
|
|
@@ -5352,6 +5380,45 @@ declare abstract class ShardDO {
|
|
|
5352
5380
|
* `LUNORA_REQUEST_LOG_EMIT` so a hot shard doesn't emit a line per call.
|
|
5353
5381
|
*/
|
|
5354
5382
|
private persistRequestLog;
|
|
5383
|
+
/**
|
|
5384
|
+
* Write every buffered request-log row. Best-effort and never retried: the
|
|
5385
|
+
* buffer is emptied before the write, so a failing SQL handle drops the batch
|
|
5386
|
+
* instead of failing the request or growing the buffer forever. The exception is
|
|
5387
|
+
* a host refusal, see {@link ShardDO.keepRefusedRequestLogRows}.
|
|
5388
|
+
* @returns whether refused rows were put back; the newest row is then among them
|
|
5389
|
+
*/
|
|
5390
|
+
private writePendingRequestLog;
|
|
5391
|
+
/**
|
|
5392
|
+
* Re-run the live Logs/Issues subscriptions after a retried error row landed.
|
|
5393
|
+
* Merged straight into the refresh state, as the global poll tick does, rather
|
|
5394
|
+
* than through `recordChangedTable` + `flushChangedTables`: this can run from the
|
|
5395
|
+
* timer or inside another dispatch, and draining the shared changed-table set
|
|
5396
|
+
* there would take an in-flight dispatch's writes from it. Never throws.
|
|
5397
|
+
*/
|
|
5398
|
+
private refreshForRetriedErrorRows;
|
|
5399
|
+
/**
|
|
5400
|
+
* Put rows the host refused with `SHARD_UNAVAILABLE` back at the front of the
|
|
5401
|
+
* buffer and retry them on the timer. The Node host refuses SQL from any task but
|
|
5402
|
+
* the one holding an open transaction, so a flush that lands while a mutation
|
|
5403
|
+
* awaits (the timer, a query's count flush, a read) would otherwise lose the
|
|
5404
|
+
* batch. Nothing of a refused row was written, so retrying it cannot duplicate.
|
|
5405
|
+
*
|
|
5406
|
+
* The buffer stays bounded at {@link REQUEST_LOG_MAX_BATCH}: past it, the oldest
|
|
5407
|
+
* rows are dropped, successes before errors, and an error row is never dropped
|
|
5408
|
+
* while a success remains. The retry runs only while rows are buffered, and any
|
|
5409
|
+
* dispatch arriving meanwhile flushes as usual.
|
|
5410
|
+
*/
|
|
5411
|
+
private keepRefusedRequestLogRows;
|
|
5412
|
+
/**
|
|
5413
|
+
* Arm the one-shot {@link REQUEST_LOG_FLUSH_DELAY_MS} write of the buffer, unless
|
|
5414
|
+
* one is already pending: a burst arms one timer, never one per dispatch. The
|
|
5415
|
+
* write runs outside any request, so it swallows everything rather than throw
|
|
5416
|
+
* into the event loop. Like every success write it does not mark the table
|
|
5417
|
+
* changed; only landing an error row the host refused earlier refreshes (see
|
|
5418
|
+
* {@link ShardDO.refreshForRetriedErrorRows}). On Cloudflare a pending timer keeps the instance from hibernating
|
|
5419
|
+
* until it fires, at most this one delay per burst.
|
|
5420
|
+
*/
|
|
5421
|
+
private armRequestLogTimer;
|
|
5355
5422
|
/**
|
|
5356
5423
|
* Stamp the deploying Worker's version onto a request-log entry, so the
|
|
5357
5424
|
* durable row AND the emitted Workers-Logs event both carry it.
|
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-Bms_fuoY.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-Bms_fuoY.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-C9ZFrXD-.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};
|