|
|
@@ -27,8 +27,6 @@ interface ProjectionDefinition<
|
|
|
key: K
|
|
|
/** Validates persisted state before it seeds a fold. */
|
|
|
stateSchema: ZodType<S>
|
|
|
- /** Persist a host-only unit. Client-visible units are always persisted. */
|
|
|
- persist?: boolean
|
|
|
/**
|
|
|
* State for the empty log.
|
|
|
* @returns the initial state.
|
|
|
@@ -114,7 +112,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
|
|
|
|
|
|
### `ctx.sessionProjectionCache` — `SessionProjectionCache`
|
|
|
|
|
|
-The persisted projection cache service. Checkpoints live sessions on a throttled write-behind (count/interval triggers from Config) plus two mandatory points — `turn/end` and session disposal (the live-to-cold moment) — and serves the cold-read ladder: cached file, persistence `readFrom` tail, registry `restore`, durable write-back. Every durable write is fail-soft: failures log a warning and the cache self-heals on the next write or cold read. A persistence backend without a per-session directory (e.g. sqlite) disables the durable cache: writes no-op, cold reads fall to the full-log rung.
|
|
|
+The persisted projection cache service. Checkpoints live sessions on a throttled write-behind (count/interval triggers from Config) plus two mandatory points — `turn/end` and session disposal (the live-to-cold moment) — and serves the cached rows for a session header. Every durable write is fail-soft: failures log a warning and the cache self-heals on the next write. The cache owns its directory tree and never consults the persistence layer.
|
|
|
|
|
|
```ts cordis-catalog
|
|
|
/**
|
|
|
@@ -122,9 +120,7 @@ The persisted projection cache service. Checkpoints live sessions on a throttled
|
|
|
* (version-matching keys only), each cut carried with its watermark so a
|
|
|
* client value store can seed under its higher-seq-wins rule — as stale as
|
|
|
* the last durable checkpoint but never wrong, and never from an unrelated
|
|
|
- * log (the caller's header is the identity witness). Fresher paths (the
|
|
|
- * history tail baseline, {@link coldSnapshot}) supersede these values
|
|
|
- * whenever a session is actually opened.
|
|
|
+ * log (the caller's header is the identity witness).
|
|
|
* @param meta - the listed session's header (identity witness; no log read).
|
|
|
* @returns the cut (`asOfSeq` = lowest served-row watermark), or
|
|
|
* `undefined` when no usable row exists for this lifecycle.
|
|
|
@@ -141,26 +137,11 @@ async cachedSnapshot(meta: SessionHeader): Promise<ProjectionSnapshot | undefine
|
|
|
* @returns resolution after durability and event emission.
|
|
|
*/
|
|
|
async write(session: Session): Promise<void>
|
|
|
-
|
|
|
-/**
|
|
|
- * Cold-read one persisted session's projections with zero full-log load:
|
|
|
- * cached rows + a persistence `readFrom` tail from the registry's restore
|
|
|
- * floor, refolded by the registry and written back (fail-soft) so the next
|
|
|
- * cold read starts closer. A cache row invalidated by a shrunk log
|
|
|
- * (crash-repair truncation) triggers one full re-read from seq 0 — the
|
|
|
- * ladder's slow rung, still no crash. Rejects when the session has no
|
|
|
- * persisted log (`not found` from the persistence seam).
|
|
|
- * @param meta - the persisted session whose projections are read (locates
|
|
|
- * the cache file and witnesses the stored log identity).
|
|
|
- * @param signal - optional cancellation for the persistence reads.
|
|
|
- * @returns the snapshot cut at the stored log end.
|
|
|
- */
|
|
|
-async coldSnapshot(meta: SessionHeader, signal?: AbortSignal): Promise<ProjectionSnapshot>
|
|
|
```
|
|
|
|
|
|
Types: [Session](session.md) · [SessionHeader](persistence.md)
|
|
|
|
|
|
-Source: [`packages/session/session-projection-cache/src/index.ts:78`](../../packages/session/session-projection-cache/src/index.ts)
|
|
|
+Source: [`packages/session/session-projection-cache/src/index.ts:80`](../../packages/session/session-projection-cache/src/index.ts)
|
|
|
|
|
|
<a id="ctxsessionprojections--sessionprojectionregistry"></a>
|
|
|
|