Packed admission PageLog: layout and ownership review
Source review passes for 64fbeccc59363b80d021ef786d6b7d272f6c6bab, based on
049a377a. No remaining ownership, geometry or lifetime blocker was found in
the implemented fixed-capacity, reference-free collection. This reviewer made
no code edits, compiled nothing and started no server. Actual IC lifecycle and
matched instruction/page results remain separate gates.
Geometry and normal append
The request is 65,472 payload bytes, including a 16-byte collection header. Store adds its existing 64-byte allocation header, producing one exact 65,536-byte buddy block. Construction checks the block offset's 64 KiB alignment. The current platform's retained origin is 2 MiB, itself 64 KiB aligned, so these logical offsets also align to absolute Wasm tracking regions. Native Vec host pointers need not have that alignment; their logical byte offsets exercise the same saved representation, not native OS-page charges.
| Quantity | Bytes or count |
|---|---|
| Store allocation header | 64 bytes |
| Local count and immutable first ordinal | 16 bytes |
| Full-page records | 371 × 176 = 65,296 bytes |
| Remaining full-page tail | 160 bytes |
| Preallocated blocks | 45 × 65,536 = 2,949,120 bytes |
| Logical 16,384-record payload | 2,883,584 bytes |
| Total block/header/unused-slot difference | 65,536 bytes |
| Final page's admitted slots | 60 |
| Immutable directory payload | 16 + 45 × 8 = 376 bytes |
The directory, its ordinary allocation header, resource descriptors and Store arena/provider authority are additional storage. The block total is not a complete physical-memory or initialization-cost claim. Preallocation and zero initialization occur during construction, outside the ordinary append path.
A normal bound appender reads its selected page count, writes one complete
Retained value and increments that same count. It does not allocate, rewrite
the directory, publish a resource revision or update a separate persistent
length. Filling a page advances the transient tail immediately, so the next
normal append does not reread the preceding full page. Multiple independent
bindings may have stale tails and scan full pages; admissions owns one binding.
With a warm decoded descriptor cache, the separate persistent authority read is the compact provider ownership table. A descriptor-cache miss can add a descriptor-region read. Codec/runtime caches, root admission and Reactor work also belong to the complete IC execution. Thus one queue page read/write is a source-level queue property, not proof that a whole ingress pays one region. Native changed-byte tests cannot count unchanged stores or all accessed pages.
Existing authority reused
- The constructor creates distinct private allocations owned by one PageLog resource. No typed PageLog operation relocates, frees or replaces individual pages. Its admitted directory is immutable for that resource's lifetime.
- The appender stores byte offsets and an exact
Some(NativeOriginSession), rather than a pinned host pointer. Every cached-payload access checks the opening and re-admits the current resource serial, owner and active state. Retirement/reuse rejects the old binding. Reopening creates another session. - Each operation borrows a fresh sparse
RetainedRegion. Native Vec growth between operations can move its host backing without invalidating offsets; the selected window is resolved from the new backing. No pointer escapes a callback, and no Store allocation or retirement occurs within its exclusive mutation loan. T::readandT::writepreserve the existing retained ABI, including initialized padding and unaligned native access. Reference-owning and non-fitting element layouts fail throughCodec::VALIDATE, publicfrom_idand nestedRetained::NATIVE_VALIDATE; the constructor is not the only validation path.- The existing immutable first ordinal rejects repeated page addresses at distinct directory indices. The redundant pairwise duplicate scan was removed; reopening is linear in this resource's page count.
Opening validates a full-page / partial-tail / empty-page prefix. A zero-capacity
directory has no pages and returns length zero / no position; the final partial
page admits only its actual capacity. A full append returns None, which the
application maps to Busy without allocating an ID. Length never shrinks, so
index-plus-one receipt IDs, retained status slots and FIFO cursor semantics stay
unchanged. Processing still publishes the receipt result and durable cursor in
the same IC execution.
IC trap/query rollback includes both persisted bytes and transient tail state. The native rollback host reopens Store, invalidating the previous appender token. KEEP reconstructs the runtime and binding, then derives pending work from saved page counts and the saved cursor; it does not trust an old transient length.
The author reports four native PageLog tests, two compile-fail contracts and nine Fourcans tests passing under a 529-file source guard. These cover page and partial-page boundaries, capacity, independent bindings, resource retirement/ reuse, reopening and rollback across page rollover. Dedicated zero-capacity and same-opening Vec relocation cases were suggested for the fixture follow-up; this review establishes their access-path argument rather than claiming those additional tests ran. The actual IC queue probe and matched Heavy16 comparison must use the newly built ordinary artifacts.
Reviewed source hashes
SHA256 values at the frozen commit:
| File | SHA256 |
|---|---|
ver1/crates/cdk-rsx-collections/src/retained/page_log.rs |
f666b320ac379e89843a6339470a2d95b8e4df1ed9a6b94f1ca5cd101197885e |
ver1/crates/cdk-rsx-collections/tests/page_log.rs |
c055358b2d79eeaa46918b2f7c6724b68421b2d98a032369bce95ab0de23052c |
ver1/crates/cdk-rsx-store/src/storage.rs |
53f8fdbbc0b259713177e0778a6dc297b4b72d28d82f42490b34ef12d1b5fc14 |
rrt/bench/fourcans/src/admissions/mod.rs |
d182605b30791ded7a6026659dd93bcb0dbd851886466b230e25de7c0eb26ae0 |
rrt/bench/fourcans/src/admissions/memory/v1.rs |
636128823d37fc379a2dbcc79dd0582e76c3644887f709fbd5af749d9b5e16e6 |