OverviewFilesCommitsIssuesDocsReleasesPeers

keet-daemon commits / 1283246

design: R4b-1..3 done (keetd c613b42, fb50896, R4b-3 on r4): streamx generalized, rn, async generators
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
128324653f017bcf620b54bbd43c13507ca36f88
by plankatron <fleeky@gmail.com> · 2026-10-06T18:27:43.000Z

Changed files (1) +37 -0

docs/CPP-PORT-DESIGN.md +37 -0
……@@ -3600,6 +3600,43 @@ injected per layer:
36003600 - **Order:** R4b-1 streamx generalized (gates unchanged + object mode) → R4b-2 rt completion
36013601 FIFO + State / batches / sessions / snapshots / CFs → R4b-3 Iterator, `keys`, `peek` →
36023602 R4b-4 gate + drill. L2 keeps its synchronous Db until R4c.
3603- **R4b-1 DONE 2026-10-06** (keetd c613b42 on `r4`). `ss::BasicDuplex<T>` (hc/basic_duplex.h): the
3604 streamx core over any element type, with `defaultByteLength` (a typed array's length, else
3605 1024), `map` / `mapReadable` / `mapWritable` (a readable map returning null skips; `unshift`
3606 maps, then `push` maps the last pending again — streamx's own code), the byteLength options,
3607 `setReadableMap`, and streamx's Readable (`ReadableOnly`: WRITE_DONE from the start, no
3608 writable side). The byte stream is its Buf instantiation, names unchanged. Duplex gate +21
3609 scripts; drills r4b1 9/9 (two first-run survivors were script gaps: a Readable's lone 'drain'
3610 listener; a `_read` that ends synchronously during the open callback), m5g4e3b 20/20 on the
3611 moved code. ctest 83/83.
3612- **R4b-2 DONE 2026-10-06** (keetd fb50896). rn: rocksdb-native 3.17.4 in full (above), plus
3613 `rt::complete` (parked completions: Real = a `uv_async`, referenced only while pending; Virtual
3614 = the poll phase; one native callback each, a pass delivers what was queued before it began)
3615 and `js::asyncFn`. Gate `tools/rn`: Bare at `UV_THREADPOOL_SIZE=1` vs rn on rt real AND virtual,
3616 identical traces then identical stores (dumped by rocksdb-native: the on-disk bytes are
3617 cross-checked). Drill r4b2 17/17. ctest 84/84.
3618 - MEASURED (the gate's traces): a read batch's per-op promises settle in index order and its
3619 flush promise one tick later; separate `get`s are separate completions; an un-destroyed batch
3620 blocks close forever (its handle ref), and Bare exits with that promise pending.
3621- **R4b-3 (iterators, peek, keys).**
3622 - `js::AsyncGenerator<T>`: ECMA-262 §27.9 step for step (the five states, the request queue,
3623 next / return / throw, `co_yield` = Await then AsyncGeneratorYield, a return at a yield
3624 unwrapped by Await then unwound with `js::GeneratorReturn` so the body's destructors run as
3625 its finally). Port rule: an async generator's `return x` is `co_return co_await
3626 js::resolve(x)` (JS awaits the operand BEFORE the finally blocks; C++ destroys locals at
3627 co_return). `js::resolve(MaybePromise)` = PromiseResolve. Measured on Bare first: the body
3628 starts inside the first next(); a yield costs one hop, then queued requests resume the body
3629 in that job; return() at a yield awaits, runs the finally, resolves.
3630 - `RocksDB::keys` on it; AsyncIteratorClose inside: an abrupt exit at the yield closes the
3631 inner iterator (a throw wins over return()'s own error, a return lets it through).
3632 - Gates: the js gate +14 generator scripts; the rn gate +11 (every range bound, reverse,
3633 keys-only, limit 3 / 8 / 0 / negative over 20 entries, 40 entries, a snapshot, before ready,
3634 while suspended, empty, an early break, peek with a diagnostics snapshot at its settlement,
3635 keys with ranges / reverse / limit / break, gets deferred around an iterator's open). New
3636 runner ops: `diagOn`, `defer`.
3637 - Drills: r4a-gen 10/10 (survivor "drain treats a return as a next" → script genQueuedReturn),
3638 r4b3 12/12 (survivors → scripts: a negative limit over 20 entries; peek's close seen by
3639 `diagOn`; an inline open seen by gets deferred past the open's submission).
36033640- **Then 4e-4** (`createProtocolStream` / `replicate`): the first gate that composes the stack
36043641 is a COMPOSED trace against JS (secret-stream + protomux + replicator), now meaningful.
36053642