Skip to main content

Module api

Module api 

Source
Expand description

Top-level user-facing IPC API.

Wraps the MmfDispatcher family pick behind one type per access pattern, so callers express WHAT they want (streaming, work-stealing, key-value) and the dispatcher decides which MMF-backed primitive to use under the hood. The shape of the API mirrors std::sync::mpsc::channel but adds:

  • cross-process visibility via memory-mapped file backing
  • kernel-bypass data path (atomic protocol layer in user space)
  • per-workload routing to the empirically-best primitive

Three intent types are exposed:

  • Channel<T>: streaming MPMC. Backed by SharedRing.
  • WorkStealQueue<T>: single-owner, multi-thief work-stealing. Backed by MmfDispatcher’s within-family pick (Chase-Lev / KHPD / LOH / URD / KHL / Fcl) for the deque family. Currently exposes the Chase-Lev T: Marshal surface; batched-fast deque variants are routed through internally for byte-slice payloads.
  • KvMap<K, V>: key-value lookup. Backed by SharedHashMap.

§Example

use subetha_cxc::api::Channel;
use subetha_cxc::MmfWorkloadShape;

let chan: Channel<u64> = Channel::create(
    "/tmp/my-channel.bin",
    MmfWorkloadShape::StreamingMpmc { n_producers: 4, n_consumers: 4 },
    1024,
).expect("create channel");
chan.send(&42).expect("send");
let v = chan.recv().expect("recv");
assert_eq!(v, 42);

Structs§

AutoIpc
Builder for an auto-inferred IPC endpoint. The caller describes the workload with declarative hints; the builder infers the MmfWorkloadShape, asks MmfDispatcher for the family, and constructs the right typed-intent wrapper.
Channel
Streaming MPMC channel, backed by SharedRing. Use this for arrival-order queues with multiple producers and multiple consumers (the canonical request-fanout / result-fanin shape).
KvMap
Key-value lookup map, backed by SharedHashMap. Multiple processes can insert + look up concurrently via the shared MMF.
RecvFut
Future from Channel::recv_async.
SendFut
Future from Channel::send_async.
WorkStealQueue
Single-owner, multi-thief work-stealing queue, backed by the SharedDeque<T> family. The owner pushes via push; thieves drain via steal.

Enums§

ApiError
Errors returned by the user-facing IPC types.