Skip to content

v0.1.0 — initial extraction from monitor365

Choose a tag to compare

@LarsArtmann LarsArtmann released this 20 Jul 07:27
· 253 commits to master since this release

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 recovery
  • append(), flush(), read_from(), delete_acked(), latest_sequence(), pending_count(), store_pressure(), is_overloaded() public API
  • SegmentError (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 by append()) are now computed atomically inside the same mutex lock that takes ownership of the pending events. Previously a stale next_seq re-read in a second lock could corrupt segment filenames under concurrent append().

See CHANGELOG for the full change history.