Skip to content

Port SlateDB integration to 0.12.x UniFFI bindings#280

Closed
em3s wants to merge 1 commit intonext/slatedb-uniffifrom
feat/issue-255-slatedb-uniffi
Closed

Port SlateDB integration to 0.12.x UniFFI bindings#280
em3s wants to merge 1 commit intonext/slatedb-uniffifrom
feat/issue-255-slatedb-uniffi

Conversation

@em3s
Copy link
Copy Markdown
Contributor

@em3s em3s commented Apr 25, 2026

Summary

Port SlateDB from io.slatedb:slatedb:0.11.0 (jextract) to io.slatedb:slatedb-uniffi:0.12.1 (UniFFI). Targets next/slatedb-uniffi, not main.

Closes #255

Changes

  • Dep: slatedb:0.11.0slatedb-uniffi:0.12.1.
  • Rewrite SlateDbConnections / SlateDbTable against UniFFI's async API. Drop SlateDbScheduler and per-call subscribeOn — UniFFI runs its own multithreaded Tokio runtime.
  • SlateDbTable.close() returns Mono<Void> to bridge async db.shutdown(); tests adjusted.
  • New SlateDbNativeLibrary helper extracts the bundled OS/arch native lib to a temp file and sets uniffi.component.slatedb.libraryOverride. Workaround for IronCoreLabs/uniffi-bindgen-java#58/#59 (FFM loader doesn't extract from classpath); isolated so it's a clean delete if upstream ships a classpath-aware loader.

Non-obvious lifetime / scheduling subtleties are documented inline.

How to Test

./gradlew :engine:test --tests '*SlateDb*'
SLATEDB_TEST=true ./gradlew :engine:test --tests '*SlateDBDatastoreCompatibilityTest*'

AI Assistance

  • This PR was written largely with AI assistance.
    Tool / model: claude code (opus 4.7 1m)

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. maintenance Maintenance work. labels Apr 25, 2026
@em3s em3s changed the base branch from next/slatedb to next/slatedb-uniffi April 25, 2026 15:49
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Apr 25, 2026
@em3s em3s marked this pull request as draft April 25, 2026 16:19
- Replace io.slatedb:slatedb:0.11.0 (jextract) with
  io.slatedb:slatedb-uniffi:0.12.1 (UniFFI).
- Drop SlateDbScheduler and per-call subscribeOn — UniFFI runs its own
  multithreaded Tokio runtime, so callers stay on whatever scheduler they
  pick.
- Use the lazy Mono.fromFuture { supplier } overload so each
  CompletableFuture is created at subscription time, avoiding races in
  chains like put.then(delete).then(get).
- Wrap batch() in Mono.defer + doFinally close so the WriteBatch handle
  is pinned across the async db.write — without it UniFFI's cleaner could
  free the Rust handle mid-flight.
- SlateDbTable.close() returns Mono<Void> for the new async db.shutdown();
  test setUp/tearDown adjusted. Callers (SlateDbHashLabel,
  SlateDbIndexedLabel, SlateDbStorage, SlateDbOptions) unchanged.
- New SlateDbNativeLibrary helper extracts the bundled OS/arch native
  library to a temp file and sets uniffi.component.slatedb.libraryOverride
  — workaround for IronCoreLabs/uniffi-bindgen-java#58 / #59 (FFM loader
  does not extract from classpath). Isolated so it can be deleted whole
  once upstream ships a classpath-aware loader.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@em3s em3s force-pushed the feat/issue-255-slatedb-uniffi branch from 8153445 to fc41691 Compare April 26, 2026 09:31
@em3s
Copy link
Copy Markdown
Contributor Author

em3s commented Apr 26, 2026

Closing as experiment complete. Will resume once the v0.5.0 / v0.6.0 milestones reduce our tech debt and make storage backend extension easier.

@em3s em3s closed this Apr 26, 2026
This was referenced Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Maintenance work. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant