segment-buffer 0.5.0

Durable bounded queue: batch-spills to zstd+CBOR segment files with ack-based deletion and filename-based crash recovery. No WAL, no metadata DB.
Documentation
[package]
name = "segment-buffer"
version = "0.5.0"
edition = "2021"
rust-version = "1.86"
authors = ["Lars Artmann <lars@larsartmann.com>"]
license = "Apache-2.0"
description = "Durable bounded queue: batch-spills to zstd+CBOR segment files with ack-based deletion and filename-based crash recovery. No WAL, no metadata DB."
repository = "https://github.com/LarsArtmann/segment-buffer"
homepage = "https://github.com/LarsArtmann/segment-buffer"
documentation = "https://docs.rs/segment-buffer"
readme = "README.md"
keywords = ["queue", "disk", "durable", "segment", "buffer"]
categories = ["data-structures", "filesystem"]
exclude = ["/target", "/.github", "/fuzz", "/benches"]

[features]
default = []
encryption = ["dep:aes-gcm", "dep:chacha20poly1305", "dep:rand"]
# Exposes the `fuzz_hooks` module (parse_filename, wrap/unwrap_envelope,
# SegmentRange) so out-of-tree fuzz targets and deep integration tests can
# drive byte-level invariants directly. **Not part of the semver contract**:
# items reachable through this feature may change in any release without a
# major bump. The in-tree fuzz crate enables this in `fuzz/Cargo.toml`.
fuzz = []
# Enable `loom` to compile the crate under loom's concurrency model. parking_lot
# 0.12 detects `--cfg loom` at compile time (no cargo feature needed) and
# switches its `Mutex<T>` to `loom::sync::Mutex<T>` automatically. Run with:
#
#   RUSTFLAGS="--cfg loom" cargo test --features loom --test loom -- --release
#
# Loom does NOT model the filesystem, so the loom test exercises the buffer
# through a `SegmentStore` mock (loom::sync::Mutex<HashMap<..>>) injected via
# `SegmentBuffer::open_with_store`. This covers BOTH the in-memory hot path
# (append/pending_count/latest_sequence/stats/append_all) AND the
# delete_acked + append interleaving (the head_seq <= pending_start clamp).
# flush/recover/read_from still touch byte-level encode/decode that loom has
# no interest in enumerating; their concurrency contracts stay covered by
# the stress test `concurrency_4_writers_1_reader_10k_events`.
loom = []

[lints.rust]
# `loom` is set via RUSTFLAGS, not Cargo features, so rustc's check-cfg needs
# to be told it exists to avoid the `unexpected_cfgs` warning under loom runs.
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)'] }

[dependencies]
ciborium = "0.2"
zstd = "0.13"
parking_lot = "0.12"
tracing = "0.1"
thiserror = "2"
serde = "1"
fs4 = "1.1"
aes-gcm = { version = "0.11", optional = true }
chacha20poly1305 = { version = "0.10", optional = true }
rand = { version = "0.10", optional = true }

[dev-dependencies]
tempfile = "3"
serde = { version = "1", features = ["derive"] }
criterion = { version = "0.8", default-features = false, features = ["cargo_bench_support"] }
proptest = "1"
loom = "0.7"

[[example]]
name = "encrypted"
required-features = ["encryption"]

[[bench]]
name = "bench_append"
harness = false

[[bench]]
name = "bench_read_from"
harness = false

[[bench]]
name = "bench_delete_acked"
harness = false

[[bench]]
name = "bench_recover"
harness = false

[[bench]]
name = "bench_stats"
harness = false

[[bench]]
name = "bench_read_vs_for_each"
harness = false

[[bench]]
name = "bench_append_all"
harness = false

[[bench]]
name = "bench_durability_policy"
harness = false