@lunora/do 1.0.0-alpha.297 → 1.0.0-alpha.298

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
@@ -1975,6 +1975,15 @@ declare abstract class ShardDO {
1975
1975
  private readonly attachmentCache;
1976
1976
  /** Sockets whose `serializeAttachment` already reports into {@link ShardDO.attachmentCache}. */
1977
1977
  private readonly cacheWiredSockets;
1978
+ /**
1979
+ * Sockets whose attachment the runtime refused to grow by a table set: the sets were shed for a
1980
+ * registration, or a widening write threw. Near the size limit every push would otherwise retry a
1981
+ * refused serialize; the mark lifts when an unsubscribe makes the attachment smaller, and a wake
1982
+ * clears it, which costs one more attempt.
1983
+ */
1984
+ private readonly tableSetsRefused;
1985
+ /** One-shot warning for the first socket that could not hold its table sets. */
1986
+ private tableSetsRefusedWarned;
1978
1987
  /**
1979
1988
  * Subscriptions whose refresh keeps throwing, so a deterministic failure is
1980
1989
  * not re-run (and re-announced) on every write flush. In memory only, like
@@ -6484,6 +6493,33 @@ declare abstract class ShardDO {
6484
6493
  * write-flush can diff against it.
6485
6494
  */
6486
6495
  private seedSubscriptionMemo;
6496
+ /**
6497
+ * Lift `ws`'s `tableSetsRefused` mark ahead of a subscribe that replaces an id, which can shrink the
6498
+ * attachment enough to fit table sets again. Lifted before the write, so a write that has to shed the
6499
+ * sets marks the socket again; the returned call puts the mark back when that write fails and rolls back.
6500
+ */
6501
+ private liftRefusedMark;
6502
+ private markTableSetsRefused;
6503
+ /**
6504
+ * Remove `subId`'s persisted table set, if it has one, so after a wake it counts as unknown and
6505
+ * re-runs. The attachment without the entry is smaller than the one the runtime holds, so it fits.
6506
+ */
6507
+ private dropSubscriptionTables;
6508
+ /**
6509
+ * Fold the tables `subId`'s memo just recorded into the attachment's `subTables`, the
6510
+ * copy of its dependency set that outlives hibernation. Every memo table write goes
6511
+ * through here: the persisted set may over-cover a cold memo, never under-cover it.
6512
+ * Writes only when the set grows, so a steady subscription costs no attachment write.
6513
+ *
6514
+ * A memo that re-runs on every write (admin wildcard, `retryData`) leaves no entry, and
6515
+ * so does a widened set the runtime refuses to store: keeping the older, smaller set
6516
+ * would let a write to the newly read table skip the subscription after a wake. The
6517
+ * attachment without the entry is smaller than the one the runtime already holds, so
6518
+ * it fits. A socket the runtime refused once is not widened again until an unsubscribe
6519
+ * frees room (see `tableSetsRefused`). Never throws: a lost entry only costs a re-run
6520
+ * after the next wake.
6521
+ */
6522
+ private persistSubscriptionTables;
6487
6523
  /**
6488
6524
  * Memoise `outcome` for `(ws, subId)` and push it to the socket, unless an
6489
6525
  * identical result was already sent. Always refreshes the memo's table set
@@ -7013,9 +7049,15 @@ declare abstract class ShardDO {
7013
7049
  private readAttachmentCopy;
7014
7050
  /**
7015
7051
  * Persist `value` as the socket's attachment and cache it; `undefined` clears
7016
- * both. The caller must not mutate `value` afterwards. A failed serialize
7017
- * drops the cache entry and rethrows, so the next read decodes what storage
7018
- * actually holds.
7052
+ * both. The caller must not mutate `value` afterwards.
7053
+ *
7054
+ * The table sets in `subTables` are optional and share the size limit with
7055
+ * everything a socket must hold, so a write the runtime refuses is retried
7056
+ * once as a copy without them: a registration never fails for
7057
+ * their sake, and their subscriptions re-run after a wake until a run records
7058
+ * them again. `shedTableSets: false` refuses that retry, for the write that
7059
+ * only widens one set. A write that still fails drops the cache entry and
7060
+ * rethrows, so the next read decodes what storage actually holds.
7019
7061
  */
7020
7062
  private writeAttachment;
7021
7063
  }
package/dist/index.d.ts CHANGED
@@ -1975,6 +1975,15 @@ declare abstract class ShardDO {
1975
1975
  private readonly attachmentCache;
1976
1976
  /** Sockets whose `serializeAttachment` already reports into {@link ShardDO.attachmentCache}. */
1977
1977
  private readonly cacheWiredSockets;
1978
+ /**
1979
+ * Sockets whose attachment the runtime refused to grow by a table set: the sets were shed for a
1980
+ * registration, or a widening write threw. Near the size limit every push would otherwise retry a
1981
+ * refused serialize; the mark lifts when an unsubscribe makes the attachment smaller, and a wake
1982
+ * clears it, which costs one more attempt.
1983
+ */
1984
+ private readonly tableSetsRefused;
1985
+ /** One-shot warning for the first socket that could not hold its table sets. */
1986
+ private tableSetsRefusedWarned;
1978
1987
  /**
1979
1988
  * Subscriptions whose refresh keeps throwing, so a deterministic failure is
1980
1989
  * not re-run (and re-announced) on every write flush. In memory only, like
@@ -6484,6 +6493,33 @@ declare abstract class ShardDO {
6484
6493
  * write-flush can diff against it.
6485
6494
  */
6486
6495
  private seedSubscriptionMemo;
6496
+ /**
6497
+ * Lift `ws`'s `tableSetsRefused` mark ahead of a subscribe that replaces an id, which can shrink the
6498
+ * attachment enough to fit table sets again. Lifted before the write, so a write that has to shed the
6499
+ * sets marks the socket again; the returned call puts the mark back when that write fails and rolls back.
6500
+ */
6501
+ private liftRefusedMark;
6502
+ private markTableSetsRefused;
6503
+ /**
6504
+ * Remove `subId`'s persisted table set, if it has one, so after a wake it counts as unknown and
6505
+ * re-runs. The attachment without the entry is smaller than the one the runtime holds, so it fits.
6506
+ */
6507
+ private dropSubscriptionTables;
6508
+ /**
6509
+ * Fold the tables `subId`'s memo just recorded into the attachment's `subTables`, the
6510
+ * copy of its dependency set that outlives hibernation. Every memo table write goes
6511
+ * through here: the persisted set may over-cover a cold memo, never under-cover it.
6512
+ * Writes only when the set grows, so a steady subscription costs no attachment write.
6513
+ *
6514
+ * A memo that re-runs on every write (admin wildcard, `retryData`) leaves no entry, and
6515
+ * so does a widened set the runtime refuses to store: keeping the older, smaller set
6516
+ * would let a write to the newly read table skip the subscription after a wake. The
6517
+ * attachment without the entry is smaller than the one the runtime already holds, so
6518
+ * it fits. A socket the runtime refused once is not widened again until an unsubscribe
6519
+ * frees room (see `tableSetsRefused`). Never throws: a lost entry only costs a re-run
6520
+ * after the next wake.
6521
+ */
6522
+ private persistSubscriptionTables;
6487
6523
  /**
6488
6524
  * Memoise `outcome` for `(ws, subId)` and push it to the socket, unless an
6489
6525
  * identical result was already sent. Always refreshes the memo's table set
@@ -7013,9 +7049,15 @@ declare abstract class ShardDO {
7013
7049
  private readAttachmentCopy;
7014
7050
  /**
7015
7051
  * Persist `value` as the socket's attachment and cache it; `undefined` clears
7016
- * both. The caller must not mutate `value` afterwards. A failed serialize
7017
- * drops the cache entry and rethrows, so the next read decodes what storage
7018
- * actually holds.
7052
+ * both. The caller must not mutate `value` afterwards.
7053
+ *
7054
+ * The table sets in `subTables` are optional and share the size limit with
7055
+ * everything a socket must hold, so a write the runtime refuses is retried
7056
+ * once as a copy without them: a registration never fails for
7057
+ * their sake, and their subscriptions re-run after a wake until a run records
7058
+ * them again. `shedTableSets: false` refuses that retry, for the write that
7059
+ * only widens one set. A write that still fails drops the cache entry and
7060
+ * rethrows, so the next read decodes what storage actually holds.
7019
7061
  */
7020
7062
  private writeAttachment;
7021
7063
  }
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-BBpQ1RG2.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};
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-Ch13DbE3.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};