Skip to main content

Module shared_umbra_pointer

Module shared_umbra_pointer 

Source
Expand description

SharedUmbraPointer<T> - cross-process content-prefixed pointer.

The cross-process lift of subetha_pointers::UmbraPointer<T>. The mechanical change is one field swap:

in-process:  target: *const T        (8 bytes, address-space-bound)
cross-proc:  target: OffsetPtr<T>    (4 bytes, byte-stable)

Everything else stays identical: 16-byte slot, u32 prefix at the same offset, SIMD-friendly array layout for prefix-shortcircuit scans, prefix derived from content (first 4 bytes or hash).

§Why a separate primitive

A *const T is process-local: it indexes the heap of the constructing process. Writing one into an MMF and reading it from another process gives a wild pointer. OffsetPtr<T> is an index into a SharedRegion<T> - every process resolves it via its own mapping’s base pointer.

§Pod-safety

SharedUmbraPointer<T> is Copy + repr(C, align(16)) with no Drop side effects. It can live inside any other MMF container (SharedVec, SharedHashMap, SharedBTreeMap, …) and be read in any process holding the matching region.

§Composition pattern

SharedRegion<T>        owns the underlying T values
SharedVec<SharedUmbraPointer<T>>   stores prefix-prefixed handles
scan callers           filter by prefix in-register;
                        only on prefix match do they resolve
                        the OffsetPtr through the region

The architectural win is identical to the in-process Umbra: 95 % of prefix mismatches reject without paying the cache miss to load the underlying T from the region MMF.

Structs§

SharedUmbraPointer
16-byte cross-process content-prefixed pointer.

Traits§

UmbraExtension
Marker trait for user-defined extension types stored in SharedUmbraPointer’s reserved bytes. Each implementor declares a unique TAG so different consumers don’t misinterpret each other’s payloads.