Repository navigation
v0.1.0 — initial extraction from monitor365
Initial public release. Extracted from monitor365 and proven on 597M+ events in production.
SegmentBuffer<T> — durable bounded queue backed by zstd-compressed CBOR segment files. Generic over any T: Serialize + DeserializeOwned + Clone + Send + 'static. Filename-based crash recovery (no WAL, no metadata DB): state is fully encoded in seg_{start:012}_{end:012}.zst filenames. SegmentCipher trait for pluggable at-rest encryption with AesGcmCipher (AES-256-GCM, random 12-byte nonce prefix) behind the encryption feature.
Added
SegmentBuffer<T>core type;SegmentConfig(batch size, flush interval, max disk usage, compression level)open(dir, config)constructor with filename-based crash recoveryappend(),flush(),read_from(),delete_acked(),latest_sequence(),pending_count(),store_pressure(),is_overloaded()public APISegmentError(thiserror-based):Io,Cbor,Cipher,Integrity- 26 unit tests + 2 doc tests (basic CRUD, partial reads, limits, crash recovery, 4-writer/1-reader concurrency over 10K events, time-based auto-flush, error paths, encryption roundtrips, pressure/overload boundaries)
Fixed
- Concurrency race in
flush()/append(): sequence numbers (start_seq,end_seq, and the value returned byappend()) are now computed atomically inside the same mutex lock that takes ownership of the pending events. Previously a stalenext_seqre-read in a second lock could corrupt segment filenames under concurrentappend().
See CHANGELOG for the full change history.