Skip to content

v2.0.0

Latest

Choose a tag to compare

@khrs khrs released this 01 Oct 06:16
· 1 commit to master since this release
fdf911e

What's Changed

  • New V2 file format with automatic migration. QueueFile::open now 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
    offsets 0 and 4096), 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 (via crc32fast). Corruption is detected on read and
    surfaced as Error::ChecksumMismatch instead 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 proper Error instead. Error handling was reworked from snafu to thiserror.
  • peek_into for zero-allocation reads. Read the head element into a
    caller-owned Vec<u8> to reuse buffers across calls and avoid per-read allocation.
  • peek and iter now yield Vec<u8> instead of Box<[u8]>, making returned
    data easier to reuse and mutate. (Breaking change.)
  • add_n no longer requires Clone on the element type, and batches multiple
    additions into a single write with batched syncs for better throughput.
  • QueueFile is now !Send + !Sync to 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 in Iter::nth, and various I/O batching
    reduce both allocations and fsync calls.
  • Codebase modularized and lints tightened; MSRV raised to 1.71.

Full Changelog: v1.4.10...v2.0.0