Skip to content

Catalog

subetha-cxc master catalog

Every MMF-backed primitive in subetha-cxc, grouped by category, with a one-line description and a “use when…” hint per type. The Type column links to the per-category page where the primitive’s prose doc lives; the Source column links to its canonical in-source-tree .md (the per-type design doc).

For the alphabetised lookup (every name A-Z), see index-all . For the role-pair-driven selection guide, see Pick the right primitive .

Rings, stacks, and queues

Bounded, lock-free FIFO / LIFO / pub-sub structures.

TypeWhat it isUse whenSource
SharedRing<P>Cross-thread / cross-process lock-free MPMC ringMultiple producers AND multiple consumers compete on one bounded queueSHARED_RING.md
SharedBroadcastRingSingle-producer, multi-consumer pub/sub ringOne process broadcasts events; many subscribers each consume the full stream independentlySHARED_BROADCAST_RING.md
SharedTreiberStack<T>Cross-process lock-free LIFO stackLIFO ordering matters and contention is moderate; one CAS per push/popSHARED_TREIBER_STACK.md
BlockingSpscRingSPSC ring + 2 CrossProcessWaker for cross-process blocking send / recvSingle producer + single consumer want to park kernel-side instead of spinning when the ring is empty / full; cross-process safe on Linux via SHARED futexblocking_spsc_ring.rs
BlockingMpscRingComposed-SPSC MPSC fan-in + per-ring producer wakers + shared consumer wakerN producers + 1 consumer want cross-process blocking semantics; per-producer FIFO; consumer parks on a shared waker any producer can fireblocking_mpsc_ring.rs
BlockingMpmcRingComposed-SPSC MPMC grid + per-ring producer wakers + per-subset consumer wakersN producers + M consumers want cross-process blocking semantics; each consumer owns a subset of rings and parks on its own wakerblocking_mpmc_ring.rs

Maps, lists, and sequences

Keyed lookup and ordered storage.

TypeWhat it isUse whenSource
SharedHashMap<K, V>Cross-process open-addressed hash mapKey-value with O(1) lookup; FNV-1a hashing for cross-process determinismSHARED_HASH_MAP.md
SharedBTreeMap<K, V>Cross-process ordered map via B-treeKey-value with ordered iteration; range queries neededSHARED_BTREE_MAP.md
SharedLinkedList<T>Cross-process doubly-linked listNeed stable iterator positions across mutations; not random accessSHARED_LINKED_LIST.md
SharedVec<T>Cross-process bounded indexable sequencePush/index/pop with a known capacity ceilingSHARED_VEC.md

Atomics and cells

Scalar shared state.

TypeWhat it isUse whenSource
SharedAtomicU32 / SharedAtomicU64 / SharedAtomicBoolCross-process atomic counter / flagSingle integer or bool flag shared across processes; cheaper than any mapSHARED_ATOMIC.md
SharedCell<T>Cross-process single-value cellOne typed value updated atomically; reads and writes from any processSHARED_CELL.md
SharedOnceCell<T>Cross-process init-once cellInitialise a value exactly once; subsequent processes read the cached resultSHARED_ONCE_CELL.md
SharedAsyncPointer<T>Cross-process lazy / speculative pointerSpeculative reads; the first process to materialise wins, others race-free observeSHARED_ASYNC_POINTER.md

Caches

TypeWhat it isUse whenSource
SharedLRUCache<K, V>Cross-process LRU cacheBounded keyed cache with eviction; shared by many processesSHARED_LRU_CACHE.md

Locks and synchronisation

Mutual-exclusion and rate-limiting primitives.

TypeWhat it isUse whenSource
SharedRWLockCross-process reader-writer lock with writer preferenceMany readers, occasional writer; readers must not block each otherSHARED_RW_LOCK.md
SharedSemaphoreCross-process counting semaphoreBounded resource pool (N concurrent users); acquire / release patternSHARED_SEMAPHORE.md
SharedRateLimiterCross-process token-bucket rate limiterThrottle requests across many processes against one shared budgetSHARED_RATE_LIMITER.md
SharedFenceClockHybrid Logical Clock (HLC) lifted to a process boundaryNeed a monotonic timestamp that orders events across processesSHARED_FENCE_CLOCK.md

Probabilistic sketches

Approximate aggregations - sub-linear memory for the cardinality of values they see.

TypeWhat it isUse whenSource
SharedBitVecCross-process bit-packed boolean arrayDense set membership over a known small key spaceSHARED_BIT_VEC.md
SharedBloomFilterCross-process probabilistic set membershipApproximate “has key X been seen?” with controlled false-positive rateSHARED_BLOOM_FILTER.md
SharedBlockedBloomFilterCache-blocked probabilistic set membershipLarge-scale membership where one cache line per query matters (past L3)SHARED_BLOCKED_BLOOM_FILTER.md
SharedCountMinSketchCross-process probabilistic frequency counterApproximate counts per key without keeping the keys themselvesSHARED_COUNT_MIN_SKETCH.md
SharedHyperLogLogCross-process probabilistic distinct-countCount unique elements with very low memory; merges across processesSHARED_HYPER_LOG_LOG.md
SharedHistogramCross-process bucketed counterLatency / value distributions binned at fixed bucketsSHARED_HISTOGRAM.md
SharedReservoirSampler<T>Cross-process uniform random sampleSample N items from an unknown-size streamSHARED_RESERVOIR_SAMPLER.md

Arenas and region storage

Pool allocators backed by an MMF.

TypeWhat it isUse whenSource
SharedStringArenaAppend-only position-independent string arenaMany small strings pooled in one MMF; refer to them by offsetSHARED_STRING_ARENA.md
SharedHandleTable<T>Cross-process ECS-style slotmapGenerational handles to slot-allocated entities; like an ECS world shared across processesSHARED_HANDLE_TABLE.md
SharedRegion<T>Cross-process typed arena with position-independent pointersBulk allocation of T inside an MMF; offset pointers between regionsSHARED_REGION.md

Ownership and election

Who-holds-the-token primitives.

TypeWhat it isUse whenSource
OwnerLease<T>Cross-process Mutex with auto-failoverExclusive resource access where the holder might die; lease auto-reassignsOWNER_LEASE.md
SharedLeaderElectionCross-process leader electionExactly one process plays the leader role; auto-elect a replacement on deathSHARED_LEADER_ELECTION.md
LazyConfig<T>Thundering-herd-proof distributed config fetchMany processes need the same config; only ONE actually fetches it; rest readLAZY_CONFIG.md

Liveness, failover, and barriers

Coordination across process boundaries.

TypeWhat it isUse whenSource
HeartbeatTablePer-process heartbeat slots in an MMFDiscover which peer processes are alive; the table backs failoverHEARTBEAT.md
FailoverWatchdogScans the heartbeat table and reclaims work from dead peersReassign owner-leases / leader-roles when a process diesFAILOVER.md
EpochBarrierMulti-process phase synchronisationAll N processes must finish phase K before any starts phase K+1EPOCH_BARRIER.md

Work distribution

Higher-level coordination layered on the substrate.

TypeWhat it isUse whenSource
EventStateLog<E, S>Event-sourced state with cross-process replayAppend-only event log + materialised state; readers reconstruct from logEVENT_STATE_LOG.md
PriorityFanoutTiered work queue with O(1) priority selectionN priority classes; consumers grab work from the highest non-empty classPRIORITY_FANOUT.md
ProgressTask<R>Distributed work with live cross-process progress reportingLong-running task split across processes; UI watches aggregated progressPROGRESS_TASK.md
BackgroundSchedulerAutonomous Pass executor backed by the MMFSchedule periodic / triggered work; survives process restartSCHEDULER.md
pass_registryClosure registry for cross-process Pass dispatchRegister handlers in process A; process B fires them via executePASS_REGISTRY.md
CrossProcessWakerUserspace-futex slot list in MMF. Every wait runs the hardware monitor tier first (MONITORX/UMONITOR on x86-64, WFE on aarch64); kernel parks are SHARED futex (Linux), non-PRIVATE _umtx_op (FreeBSD), os_sync_wait_on_address SHARED (macOS 14.4+), WaitOnAddress (Windows anon backings; cross-process Windows wakes ride the monitor tier)Backs the Blocking{Spsc,Mpsc,Mpmc}Ring wrappers; usable directly by callers who need cross-process park / wake with a per-slot target sequencecross_process_waker.rs
SharedCondvarCross-process Mesa-style condition variable; one generation counter + CrossProcessWakerCallers want condvar semantics across processes; predicate atom is caller-owned (any MMF-resident bool / counter); cross-process wake on Linux/WSL via SHARED futexshared_condvar.rs
BlockingSemaphoreCross-process counting semaphore with kernel-park slow pathCallers want SharedSemaphore semantics but with zero CPU at idle and microsecond wake latency on releaseblocking_semaphore.rs
BlockingRWLockCross-process reader-writer lock with kernel-park slow pathCallers want SharedRWLock semantics with zero CPU at idle; readers and writers both park on the same wakerblocking_rw_lock.rs
AsyncSpscRingFuture-shaped adapter on BlockingSpscRingCallers want .recv().await / .send().await semantics with any async executor (tokio, smol, async-std, custom); short-lived std::thread per in-flight future bridges kernel-park to Rust Wakerasync_ring.rs
BlockingTcpBridgeTCP bridge whose forwarder uses recv_blocking / send_blocking via spawn_blockingCallers want the existing TcpBridge’s wire format but with zero CPU at idle on both sides; replaces tokio::task::yield_now polling with cross-process futex parkblocking_tcp_bridge.rs

Specialised data structures

Less common shapes for specific workloads.

TypeWhat it isUse whenSource
SharedVersionedChain<T>Cross-process MVCC linked listTime-travel reads at a versioned snapshot; writers append new versionsSHARED_VERSIONED_CHAIN.md
SharedTimePointTile<T>BSPA + Versioned tile (16-slot snapshot-isolation scan)Time-point queries over a small set of slots; SIMD lane mask scanSHARED_TIME_POINT.md
SharedNaNValue64-bit NaN-boxed heterogeneous value cellPack a small typed value (int / float / short string) into one f64 slotSHARED_NAN_VALUE.md
SharedNaNTaggedValueNaN-boxed value where the pointer bits identify the payload typePolymorphic value cell with no out-of-line type tagSHARED_NAN_TAGGED_VALUE.md
SharedGraph<N, E>Cross-process directed graphCross-process graph adjacency; nodes and edges in one MMFSHARED_GRAPH.md
SharedUniversal<T>Layer-2 cross-process container that adapts strategySingle container that auto-picks among the IPC families based on observed loadSHARED_UNIVERSAL.md
SharedTopologyMapK_process axis observer + recommendation surfaceWatch peer-process distribution; surface placement hints for cross-process workSHARED_TOPOLOGY_MAP.md
KTowerCascade<T, DEPTH>Recursive pow2-of-pow2 cascading containerMulti-resolution indexed access; each tower level halves resolutionK_TOWER_CASCADE.md
SharedUmbraPointer<T>Cross-process content-prefixed pointerPointer comparisons that short-circuit on content prefix before derefSHARED_UMBRA_POINTER.md

IPC pointers (addressing primitives)

Low-level pointer types that other primitives compose into. Use these directly only when building a new MMF-backed type.

TypeWhat it isUse whenSource
OffsetPtr<T>File-relative offset pointer (no tag bits)Pointing into the same MMF from another process; offset from baseOFFSET_PTR.md
TaggedOffsetPtr<T, TAG_BITS>High-bit-stealing tagged offset pointerSame as OffsetPtr but you need to pack a small tag (state, type, generation) alongside the offsetTAGGED_OFFSET_PTR.md

Polymorphic substrate (Locale x Protocol x Shape x Capacity x Ordering)

Cross-axis primitives that compose under one pin-protocol contract. Each entry’s “Use when” is the situation that the substrate’s default-composed stack does NOT cover automatically.

TypeWhat it isUse whenSource
AdaptiveRingShape-morphing ring with all 4 shapes pre-allocated; peers register / unregister at runtime and the per-producer backings grow on demand (shared peer directory)Default ring type; shape auto-morphs SPSC -> MPSC -> MPMC to the live peer counts, Vyukov on declaration; registration errors only under an explicit with_contract ceilingadaptive_ring.rs
Adaptive orderingOrdering axis on stamped AdaptiveRings: push stamps (TSC / counter / monotonic), cross-producer inversion metric, MMF-resident merge flag, strict watermark gate, single-drainer leaseGlobal FIFO as a runtime decision on the composed rings: flip the flag, the backlog orders retroactivelyordering.rs
Reorder consumerConsumer-side EXACT delivery for the best-effort by-stamp merge: ReorderBuffer (bounded min-by-stamp, adaptive window that also widens with producer growth), ReorderingReceiver, AdaptiveOrderedReceiver (auto reorder-vs-MergeStrict)You need exact global FIFO on a SharedCounter stamped ring without the strict merge’s slowest-producer taxreorder.rs
PeerDirectoryThe AdaptiveRing’s shared topology substrate: producer / consumer slot bitmaps (claim / release / recycle), published backing count, MPMC ring-ownership table (claim / handoff / crash takeover via pid liveness), topology epochConsumed by AdaptiveRing automatically; reach for it directly when composing a new multi-peer primitive that needs cross-process peer accountingpeer_directory.rs
LocaleAdaptiveRingThree-locale wrapper (Anon / File / ShmFs) around AdaptiveRing; ships with LocaleAdaptiveRingSidecar + DefaultLocalePolicy for hysteresis-gated migrationsYou want runtime morphability across storage localeslocale_adaptive_ring.rs
CapacityAdaptiveRingRuntime-resizable AdaptiveRing wrapper; ArcSwap state-swap + stale-list; ships with CapacityAdaptiveRingSidecar + DefaultCapacityPolicy (fill-ratio thresholds + hysteresis)Workload’s queueing depth has wide dynamic range; sidecar-driven elastic capacitycapacity_adaptive_ring.rs
CapacityBroadcastRingCapacity-morph wrapper around SharedBroadcastRing; same ArcSwap state-swap with lag(idx) == 0 spin discipline; subscribers stay in lockstep across morphsElastic-capacity 1P/NC fan-out broadcastcapacity_broadcast_ring.rs
CapacityPubSubRing + CapacityPubSubSubscriberCapacity-morph wrapper around PubSubRing; chain-of-backings; subscribers carry (backing_idx, position) and advance through the chainElastic-capacity 1P/NC pub/sub with per-subscriber absolute positionscapacity_pubsub_ring.rs
PubSubRing + PubSubSubscriberOne-publisher many-subscriber broadcast with per-subscriber positionsIndependent subscribers walking the same producer stream at independent ratesprotocol_pubsub.rs
VirtualEndpoint + VirtualEndpointRegistrySubstrate-level identity that resolves to local or remote at runtimeApplication code wants one addressing surface covering both same-host and cross-host peersvirtual_endpoint.rs
QosPolicy + QosSnapshotDDS-inspired runtime-mutable QoS knobsSidecar-driven morphs that depend on durability / reliability / history / latency wishesqos_policy.rs
RingContractDeclared ring contract: producer/consumer count ceilings, an ordering contract, and a capacity ceiling as one validated artifact; UNBOUNDED unless declared - the declared contract is the only source of registration errors on an AdaptiveRingPin a peer ceiling (the user override on the otherwise grow-on-demand ring), or pin an ordering contract the auto-morph cannot violate (a Fifo contract forbids the partitioned per-producer-lane shapes)ring_contract.rs
SubscriberPositionMMF-resident position counter for resumable subscribersSubscriber must survive a process restart + resume from its last positionreplay_positions.rs
ShmFileCross-platform named shared-memory backingBuilding a custom cross-process primitive on top of named shmshm_file.rs

Cross-host bridges (Cargo features)

Substrate primitives that ferry bytes between two AdaptiveRing instances on different hosts. Gated behind Cargo features.

TypeCargo featureTransportSource
QuicBridgeClient / QuicBridgeServerquic-bridgeQUIC over UDP (TLS via rustls)quic_bridge.rs
TcpBridgeClient / TcpBridgeServertcp-bridgePlain TCPtcp_bridge.rs

OS-specific substrate primitives

Primitives whose implementation is platform-gated but whose surface is shared across the targets each supports. Compiled away where unsupported; the workspace stays buildable everywhere.

TypeCargo gateWhat it isSource
DirectFileRingcfg(any(unix, windows))Non-mmap pread/pwrite ring with page-cache bypass: O_DIRECT (Linux/FreeBSD), F_NOCACHE (macOS), FILE_FLAG_NO_BUFFERING (Windows)protocol_direct_file.rs
fd_handoff::send_fd / recv_fdcfg(any(unix, windows))SCM_RIGHTS fd passing over a Unix socket (unix, incl. macOS); DuplicateHandle (Windows)fd_handoff.rs
HugepageRegioncfg(target_os = "linux")MAP_HUGETLB anon mmap (2 MB or 1 GB pages)hugepages.rs
VsockSocketcfg(any(target_os = "linux", windows))AF_VSOCK SOCK_STREAM for host-VM byte streaminglocale_vsock.rs
WireSocketwire-locale feature (Linux / Windows / FreeBSD / macOS)Raw-L2 NIC-bypass socket: AF_XDP (Linux), XDP (Windows), netmap (FreeBSD), BPF (macOS)locale_wire.rs

Two further OS-specific primitives, referenced here by source: SuperPageRegion (super_pages.rs , cfg(any(target_os = "freebsd", target_os = "macos"))) - the superpage anon mmap (FreeBSD MAP_ALIGNED_SUPER, macOS x86_64 VM_FLAGS_SUPERPAGE_SIZE_2MB) that backs AdaptiveRing::create_hugepage on those OSes; and KernelAsyncRing (kernel_async_ring.rs , cfg(any(target_os = "linux", windows, target_os = "freebsd", target_os = "macos")))

  • the kernel async-I/O ring (io_uring on Linux, IoRing on Windows, POSIX aio on FreeBSD / macOS).

Windows-only substrate primitives

OS-specific primitives gated on cfg(windows).

TypeCargo gateWhat it isSource
LargePageRegioncfg(windows)VirtualAlloc(MEM_LARGE_PAGES) private memory (2 MB pages); Windows parity for HugepageRegionlarge_pages.rs
LargePageSectioncfg(windows)SEC_LARGE_PAGES named pagefile-backed section: cross-process large-page sharing by section name (huge memory tables shared between processes)large_pages.rs

See also