Expand description
§Photon Ring
Ultra-low-latency SPMC pub/sub using seqlock-stamped ring buffers.
no_std compatible (requires alloc). The topology module uses
OS threads and is available on Linux, macOS, Windows, and other
supported platforms.
§Key design
- Seqlock per slot — stamp and payload share a cache line; readers never take a lock, writers never allocate.
T: Pod— restricts payloads to plain-old-data types where every bit pattern is valid, making torn seqlock reads harmless (no UB).- Per-consumer cursor — zero contention between subscribers.
- Single-producer — no write-side synchronisation; the seqlock invariant
is upheld by
&mut selfonPublisher::publish.
§Quick start
// Low-level SPMC channel
let (mut pub_, subs) = photon_ring::channel::<u64>(64);
let mut sub = subs.subscribe();
pub_.publish(42);
assert_eq!(sub.try_recv(), Ok(42));
// Named-topic bus
let bus = photon_ring::Photon::<u64>::new(64);
let mut p = bus.publisher("topic-a");
let mut s = bus.subscribe("topic-a");
p.publish(7);
assert_eq!(s.try_recv(), Ok(7));Re-exports§
pub use barrier::DependencyBarrier;pub use channel::channel;pub use channel::channel_bounded;pub use channel::channel_mpmc;pub use channel::Drain;pub use channel::MpPublisher;pub use channel::PublishError;pub use channel::Publisher;pub use channel::Subscribable;pub use channel::Subscriber;pub use channel::SubscriberGroup;pub use channel::TryRecvError;pub use wait::WaitStrategy;
Modules§
- affinity
- CPU core affinity helpers for deterministic cross-core latency.
- barrier
- Consumer dependency barriers for pipeline-style ordering.
- channel
- mem
- Platform-specific memory control for ring buffer allocation.
- topology
- Builder-pattern topology for multi-stage processing pipelines.
- wait
- Wait strategies for blocking receive operations.
Structs§
- Padded
- Cache-line padding to prevent false sharing between hot atomics.
- Photon
- Named-topic pub/sub bus.
- Shutdown
- A shared shutdown signal for coordinating graceful termination.
- Typed
Bus - A topic bus that supports different message types per topic.
Traits§
- Pod
- Marker trait for types safe to use with seqlock-stamped ring buffers.