Skip to content

Feat: add napi-rs Node.js bindings#31

Open
EnderRomantice wants to merge 3 commits into
NoKV-Lab:mainfrom
EnderRomantice:main
Open

Feat: add napi-rs Node.js bindings#31
EnderRomantice wants to merge 3 commits into
NoKV-Lab:mainfrom
EnderRomantice:main

Conversation

@EnderRomantice

Copy link
Copy Markdown

Add the @holt/node package with Buffer/Uint8Array Tree APIs, bigint versions, scans, WAL reopen coverage, and napi-rs generated loader/types. Keep native artifacts out of git and document local/release builds.

What changed

Added a new packages/holt-node workspace member that provides Node.js bindings for Holt through napi-rs.

The package:

  • Binds directly to the Rust holt crate.
  • Exposes Tree.open, Tree.openMemory, get, getRecord, put, delete, compareAndPut, checkpoint, scanKeys, scanRecords, and close.
  • Accepts Buffer and Uint8Array keys and values.
  • Exposes record versions as JavaScript bigint.
  • Supports prefix scans, startAfter, and delimiter common-prefix rollups.
  • Generates the Node-API loader and TypeScript declarations.
  • Keeps platform-specific .node artifacts out of Git.
  • Documents local native builds and the future multi-platform release packaging flow.
  • Keeps the existing holt-ffi C ABI unchanged.

Test plan

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test --workspace --lib --tests --locked
  • cargo test -p holt-node --locked
  • npm test in packages/holt-node
  • Built the native addon with npm run build
  • Packed the package with npm pack and installed the tarball into a standalone Next.js application.
  • Verified next build and next start.
  • Verified server-side CRUD, prefix scan, checkpoint/reopen, and bigint version handling through Next.js.
  • Fuzzing was not run; the change adds a binding layer without changing storage or WAL logic.
  • Coverage was not rerun; no existing Rust storage paths were modified.
  • Full rustdoc validation was not rerun.

No unsafe block or on-disk layout was added or changed.

Related

No related issue. This is the initial Node.js binding layer for Holt.

Add the @holt/node package with Buffer/Uint8Array Tree APIs, bigint versions, scans, WAL reopen coverage, and napi-rs generated loader/types. Keep native artifacts out of git and document local/release builds.
Add Database bindings for named-tree create/open/drop/list operations and shared checkpointing, with in-memory isolation, file reopen, and Next.js integration coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant