package snkv

All checked builds pass
  1. Overview
  2. Docs
OCaml bindings for SNKV key-value store

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.4.0.tar.gz
md5=a59b0a0fe7cca16ce9ad5e7377119219
sha512=d2ba7d61c4906910d187765f8762281fac9e6c3959a9b9de33a1a264d93712d94ef1906bcfa72bcdf5e893c3346eece40125ba0229902aa339ac19c171bdb248

doc/CHANGELOG.html

Changelog

0.4.0 - 2026-11-09

Added

  • Snkv.libversion, Snkv.libversion_number, Snkv.version, and Snkv.version_number.
  • Optional config for Snkv.open_encrypted and Kv.Encryption.open_ / open_exn; KVStoreConfig is now passed to kvstore_open_encrypted.
  • Tests for zero-as-default config, default column family creation, lazy TTL expiry, iterator values after deletion, encrypted stores with explicit config, and corrupt vector sidecars.

Changed

  • Vendored SNKV v0.9.0 (commit 6da6ca883829bb6a1e6323bc2d7e670aa53ed696).
  • Removed KVStoreConfig.fullMutex; every store handle now has one recursive lock.
  • Replaced wal_size_limit with wal_auto_checkpoint (WAL pages; 0 = default 1000, negative = disabled).
  • Negative cache_size is now a KiB memory budget instead of being treated as the default.
  • KVSTORE_JOURNAL_DELETE is now 2 and KVSTORE_SYNC_OFF is now 3; 0 means the default.
  • Breaking: Kv.Encryption.open_ and open_exn take a trailing unit because config is optional.
  • Error messages are copied with kvstore_errmsg_copy under the handle lock, so they are safe when a handle is shared.
  • Transactions belong to the thread that called begin_; other threads wait, and commit / rollback must run on that thread.
  • Iterators copy values up to 1 KB when they move, so a write to the current key is visible after the next move.
  • exists removes expired keys lazily; count may include expired keys until purge_expired runs.
  • Windows core remains supported; vector search is Unix-only.
  • sync, reencrypt, and remove_encryption reject explicit write transactions.
  • Named column families are limited to 63; drop refuses open iterators and clear requires closed iterators.
  • purge_expired joins caller transactions; incremental_vacuum is safe with open iterators.

Fixed

  • Vector stores ignore a corrupt or mismatched .usearch sidecar and rebuild the index from the database.

0.3.1 - 2026-10-25

Added

  • Core package is available on Windows again.
  • Windows-only test for the vector stub API.

Changed

  • Vector implementation is selected at build time: real implementation on Unix, stub on Windows.
  • Vector tests are skipped on Windows.
  • Vendored FP16 and replaced the compiler-specific _Float16 fallback in the vector build.

0.3.0 - 2026-10-23

Added

  • Snkv.Vector bindings for SNKV HNSW vector search.
  • Vector tests for distance spaces, TTL, sidecar persistence, encryption, errors, batch duplicates, and larger indexes.
  • doc/vector_api.md.
  • Portable vector build via Dune foreign libraries on Linux and macOS.

Changed

  • Kv.error_code now includes vector-specific codes (DimMismatch, DtypeMismatch, SpaceMismatch, IndexDropped, IndexEmpty, BadVector).
  • Vector API uses Kv.result and Kv.error_code, without trailing unit arguments.

Notes

  • 0.3.0 is Unix-only; 0.3.1 restores core package availability on Windows.

0.2.0 - 2026-10-22

Added

  • Vendored SNKV v0.8.2 and recorded provenance in lib/snkv.upstream.
  • Reproducible vendoring via scripts/update-snkv.sh.
  • Low-level config mapping and full_mutex for OCaml 5 domains.
  • Error codes from SNKV are propagated to the high-level result API.
  • Refcounted handle lifetimes for stores, column families, and iterators.
  • New test modules for basic operations, config, TTL, iterators, encryption, errors, and lifetimes.
  • doc/compatibility.md and CHANGELOG.md.

Changed

  • None filenames open an in-memory database instead of an empty path.
  • Encrypted stores now require an explicit filename.
  • checkpoint returns (log, ckpt) instead of mutating references.
  • Txn.with_transaction rolls back on exceptions.
  • C buffers are released with snkv_free.
  • High-level open applies the full Config record through kvstore_open_v2.

Fixed

  • Missing or incorrect error mapping (Busy, ReadOnly, AuthFailed, NotFound).
  • Use-after-free risks around handle finalizers and CF/iterator lifetimes.

0.1.1

  • Initial public release.