Skip to content

Version 0.1.4

Choose a tag to compare

@williamwutq williamwutq released this 25 Apr 07:47
· 777 commits to master since this release

bstack 0.1.4

This release introduces new methods for efficient payload manipulation and space management, enabling zero-cost reservations, in-place zeroing, and fast truncation.

What's New

  • extend method (Rust) / bstack_extend (C): Append n zero bytes to the tail and durable-sync. Returns the starting logical offset. n = 0 is a no-op. Useful for reserving space in the payload without a caller-supplied buffer.
  • zero method (Rust, set feature) / bstack_zero (C, BSTACK_FEATURE_SET): Overwrite n bytes with zeros in place at a logical offset and durable-sync, without changing the file size. n = 0 is a no-op; errors if offset + n exceeds the payload size.
  • discard method (Rust) / bstack_discard (C): Remove the last n bytes from the tail and durable-sync, without reading or returning the removed bytes. Equivalent to pop/bstack_pop but skips the buffer read, avoiding any allocation or copy. n = 0 is a no-op; exceeding the payload size returns an error.

Platforms

This release ships pre-built static libraries for eight platforms:

Archive Architecture OS
x86_64-apple-darwin.tar.gz x86-64 macOS
aarch64-apple-darwin.tar.gz Apple Silicon (arm64) macOS
x86_64-unknown-linux-gnu.tar.gz x86-64 Linux (glibc)
aarch64-unknown-linux-gnu.tar.gz arm64 Linux (glibc)
x86_64-unknown-linux-musl.tar.gz x86-64 Linux (musl)
aarch64-unknown-linux-musl.tar.gz arm64 Linux (musl)
x86_64-pc-windows-gnu.zip x86-64 Windows
aarch64-pc-windows-gnullvm.zip arm64 Windows

Feature variants

Both Rust and C implementations ship in two variants:

Variant Rust C
Default libbstack.rlib libbstack.a
With set libbstack-set.rlib libbstack-set.a

The set feature enables in-place overwrite of existing payload bytes without changing the file size.

Rust — add to Cargo.toml:

[dependencies]
bstack = { version = "0.1.4", features = ["set"] }   # or omit features for the default

C — link against the appropriate library and define the macro when compiling code that calls bstack_set:

cc -DBSTACK_FEATURE_SET -I path/to/c myapp.c -L path/to/c -lbstack-set