Skip to main content

Module ring_queue

Module ring_queue 

Source
Expand description

Cross-thread ring queues used between the worker, gossip, and stats threads.

The C engine uses two SPSC ring buffers, C2G_InQ and C2G_OutQ, sized at 256 slots each. The Rust port replaces them with bounded crossbeam_channel pairs of the same capacity. The RingChannels struct owns both directions (core -> gossip and gossip -> core), so callers receive a single value to wire into their thread spawning code.

§Examples

use dynomite::core::ring_queue::RingChannels;

let chans: RingChannels<u32, u32> = RingChannels::new();
chans.in_tx.send(7).unwrap();
assert_eq!(chans.in_rx.recv().unwrap(), 7);
chans.out_tx.send(11).unwrap();
assert_eq!(chans.out_rx.recv().unwrap(), 11);

Structs§

RingChannels
A pair of bounded channels that carry the core <-> gossip ring traffic.

Constants§

C2G_IN_CAPACITY
Maximum in-flight ring messages for the core -> gossip direction.
C2G_OUT_CAPACITY
Maximum in-flight ring messages for the gossip -> core direction.