Skip to content

Reuse HAMT key extractors for separately owned node payloads - #485

Draft
helly25 wants to merge 1 commit into
implement/hamt-node-iteratorfrom
implement/hamt-node-key-of
Draft

helly25 wants to merge 1 commit into
implement/hamt-node-iteratorfrom
implement/hamt-node-key-of

Conversation

@helly25

@helly25 helly25 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Address-stable HAMT containers can now reuse the existing map and set key-extraction machinery while their payloads live behind ownership handles. Keys remain borrowed directly from the stored payload, so lookup adds no copies or allocations.

AG;DR

  • Add HamtNodeKeyOf<KeyOf> to compose an existing HAMT key extractor with a separately owned payload handle.
  • Dereference the handle once and invoke the configured set or map extractor on the stored value.
  • Preserve reference identity for both set keys and immutable map keys.
  • Constrain the adapter to nonthrowing handle access and nonthrowing key extraction, matching HAMT hot-path requirements.
  • Verify constexpr set projection, map-key projection, rejected throwing extractors, and integration with shared HAMT storage.
  • Exercise address stability across persistent mutation through the shared core.
  • Document that handles must be nonempty and returned references borrow the payload lifetime.

Validation:

  • bazel --output_user_root=/private/tmp/mbo-bazel-rollback test --disk_cache=/private/tmp/mbo-bazel-disk-cache //...
  • focused pre-commit checks for this edge, with local clang-tidy intentionally skipped because CI owns it

@helly25
helly25 force-pushed the implement/hamt-node-key-of branch from ee34b66 to 0543dcf Compare September 17, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant