copybook-sequence-ring
Deterministic sequence reordering primitive for parallel pipelines.
Overview
SequenceRing accepts potentially out-of-order records tagged with a sequence ID and emits
them in strict order. This enables deterministic output when processing COBOL records across
multiple worker threads, which is critical for maintaining data integrity in parallel pipelines.
Usage
use ;
let mut ring = new; // channel capacity, max reorder window
let sender = ring.sender;
// Workers send results out of order
sender.send.unwrap;
sender.send.unwrap;
sender.send.unwrap;
// Consumer receives in strict sequence order
assert_eq!;
assert_eq!;
assert_eq!;
Public API
SequencedRecord<T>— Record wrapper with a monotonic sequence IDSequenceRing<T>— Bounded channel with reorder buffer for in-order emissionSequenceRingStats— Operational statistics (buffer size, sequence progress)
License
AGPL-3.0-or-later