OverviewFilesCommitsIssuesDocsReleasesPeers

keet-daemon commits / 585fa4f

CPP-PORT-DESIGN: R4c-2 done (hc::storage lib layer)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
585fa4f89e9f3e59cf29a76e9a120e04f2413f00
by plankatron <fleeky@gmail.com> · 2026-10-06T20:52:48.000Z

Changed files (1) +33 -0

docs/CPP-PORT-DESIGN.md +33 -0
……@@ -3865,6 +3865,39 @@ injected per layer:
38653865 - Drill r4c1: 8/8 red.
38663866 - Four older anchors (r1, r4a, r4b2) were re-anchored onto the scoped queues and re-run red.
38673867 - ctest 85/85.
3868- **R4c-2 DONE 2026-10-06** (keetd 53520c6): `hc::storage`, hypercore-storage's lib/ layer on rn.
3869 - **Where it lives.** `storage/` sits beside the frozen `hc::l2` and shares l2's keys and schema
3870 codecs. This replaces the design's "rename the old one `l2sync`": the effect is the same, and
3871 the ~170 consumer references are edited once, at R4c-4.
3872 - **What is ported.**
3873 - From lib/view.js: View, Overlay and OverlayStream. Plus lib/close-error-stream.js and
3874 index.js's Atom.
3875 - From lib/tx.js: CoreTX; CoreRX, including the tree cache's SHARED pending promise;
3876 CorestoreTX; CorestoreRX.
3877 - lib/streams.js and lib/block-dependency-stream.js, as real streamx streams.
3878 - Every getter keeps its JS shape: `async` or not, `return await`, and adoption.
3879 - **rn change.** `rn::Entry` gains a type-erased `mapped` value carrying its streamx byteLength
3880 (a Buffer's length, else 1024). This is what lets hypercore-storage's
3881 `_readableState.map = fn` port: a JS map may return any shape, and streamx counts the mapped
3882 value. rn itself maps nothing.
3883 - **Gate `tools/hs` (`r4c_hs`).** hypercore-storage's own lib/ runs on Bare at
3884 `UV_THREADPOOL_SIZE=1` against hc::storage on rt real + virtual. 20 scripts give identical
3885 traces and identical hex dumps of the corestore column family.
3886 - **Port bug the gate found:** a getter called after tryFlush must hit JS's null view. It now
3887 throws `TypeError: Cannot read properties of null (reading 'get')`, synchronously from a
3888 plain getter and as a rejection from an async one.
3889 - **Drill r4c2: 18/20 red.** Four first-run survivors were script gaps:
3890 - a tree miss alongside 1- and 2-hop getters;
3891 - a block exactly at a dependency's length;
3892 - a lazily consumed stream whose read-ahead depends on byteLength (32 for a discovery-key
3893 Buffer, 1024 for an object).
3894 - **Two equivalents, each shown:**
3895 - The drain at a dependency stream's inner close never finds data: measured, 15 of 15 closes
3896 had an empty inner buffer (close follows end, and end needs an empty buffer).
3897 - A cached tree entry is always still pending when `getTreeNode` returns it.
3898 `_resolveTreeCache` replaces or deletes it synchronously before its promise fulfills, so
3899 adopting it lands on the same hop as awaiting it.
3900 - ctest 86/86.
38683901- **Then 4e-4** (`createProtocolStream` / `replicate`): the first gate that composes the stack
38693902 is a COMPOSED trace against JS (secret-stream + protomux + replicator), now meaningful.
38703903