Repository navigation
What's Changed
- New V2 file format with automatic migration.
QueueFile::opennow creates
the V2 format, which stores a back-link in each element to enable faster, scan-free
recovery of the queue state. Existing V1 (and legacy) files are detected and
migrated transparently, preserving binary compatibility. - Dual-slot atomic header commits. The V2 format keeps two header slots (at
offsets0and4096), each tagged with a monotonic generation counter. Each
commit writes the inactive slot and then switches to it, so a crash mid-write
always leaves a valid prior header to fall back to — no torn headers. - CRC-32 integrity checks. Every V2 header slot, element header, and element
footer carries a CRC-32 (viacrc32fast). Corruption is detected on read and
surfaced asError::ChecksumMismatchinstead of returning garbage data. Each
element also stores a sequence number for ordering/recovery. - Safer API — panics replaced with errors. Operations that previously could
panic (corrupted headers, oversized elements, invalid payload lengths) now return
a properErrorinstead. Error handling was reworked fromsnafutothiserror. peek_intofor zero-allocation reads. Read the head element into a
caller-ownedVec<u8>to reuse buffers across calls and avoid per-read allocation.peekanditernow yieldVec<u8>instead ofBox<[u8]>, making returned
data easier to reuse and mutate. (Breaking change.)add_nno longer requiresCloneon the element type, and batches multiple
additions into a single write with batched syncs for better throughput.QueueFileis now!Send+!Syncto statically prevent unsafe concurrent
access to the underlying file.- Faster iteration and random access. Offset caching during iteration (with a
bounded cache size), header-only skipping inIter::nth, and various I/O batching
reduce both allocations andfsynccalls. - Codebase modularized and lints tightened; MSRV raised to 1.71.
Full Changelog: v1.4.10...v2.0.0