Skip to content

Add transactional Arena string storage - #495

Draft
helly25 wants to merge 1 commit into
implement/arena-checkpointfrom
implement/arena-string-storage
Draft

helly25 wants to merge 1 commit into
implement/arena-checkpointfrom
implement/arena-string-storage

Conversation

@helly25

@helly25 helly25 commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Add an Arena-backed string ownership adapter that copies bytes once, returns stable std::string_views, and can roll back an uncommitted copy when another interner component fails. This supplies the byte-storage half of bounded, allocation-controlled string interning without coupling storage to indexing or ID assignment.

AG;DR

  • Add ArenaStringStorage, parameterized by an Arena-compatible type.
  • Return only owned std::string_views and preserve embedded NUL bytes.
  • Make empty-string storage allocation-free.
  • Surface bounded exhaustion as std::nullopt.
  • Expose Arena checkpoints and rewind so compound interner insertion can transactionally discard unpublished bytes.
  • Keep the adapter non-copyable and non-movable because published views depend on its stable ownership domain.
  • Document the separation between byte ownership, indexing, and dense-ID assignment.
  • Test ownership, embedded NULs, rollback/reuse, empty strings, and bounded exhaustion.

Validation:

  • bazel --output_user_root=/private/tmp/mbo-arena-string-storage-bazel test //mbo/strings:arena_string_storage_test

This PR is stacked on #494.

@helly25
helly25 force-pushed the implement/arena-string-storage branch 2 times, most recently from ad8c244 to 00f06e6 Compare September 18, 2026 07:45
@helly25
helly25 force-pushed the implement/arena-string-storage branch from 00f06e6 to 34c0063 Compare September 18, 2026 08:44
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