feat(sdk): add Lance backend struct + endpoint helper (companion to #35)#36
Conversation
Companion to PR #35 (which forwarded the kv-lance feature from the SDK to surrealdb-core). PR #35 made the feature reachable at the SDK level; this PR adds the actual surface adopters need to USE the Lance backend from the SDK: - Lance struct in engine::local (mirror of RocksDb, gated by kv-lance feature) - opt/endpoint/lance.rs: endpoint helper that converts paths into lance:// URLs (mirror of rocksdb.rs) - opt/endpoint/mod.rs: register mod lance; + Lance EndpointKind variant + "lance" URL scheme parser arm - engine/any/native.rs: Lance arm in the connect-by-scheme match - engine/any/wasm.rs: same for wasm Pattern is a direct mirror of RocksDb; reviewers can diff the new files against rocksdb.rs / RocksDb's existing wiring to verify the correspondence. Concrete downstream use (AdaWorldAPI/bardioc substrate-b): ```rust use surrealdb::engine::local::Lance; use surrealdb::Surreal; #[tokio::main] async fn main() -> surrealdb::Result<()> { let db = Surreal::new::<Lance>("path/to/lance/dataset").await?; // ... use db with the Lance backend Ok(()) } ``` Without this PR, declaring features = ["kv-lance"] at the SDK level (PR #35) lets the kv-lance backend compile in via surrealdb-core but the SDK exposes no Lance struct + no lance:// endpoint helper - so adopters cannot instantiate Surreal::new::<Lance>(...) from SDK-only code. Adopters had to depend directly on surrealdb-core OR construct the Datastore by hand, both of which defeat the SDK's purpose. Tests: the existing rocksdb integration test in surrealdb/tests/api_integration/mod.rs uses the pattern "surrealdb::engine::local::{Db, RocksDb}"; a parallel Lance test can follow once this PR lands (CI bandwidth permitting; not in this PR). Provenance: - bardioc B1-step2 brutal 02 (code-correctness lens) surfaced the gap; PR #35 forwarded the feature; this PR completes the surface - Draft: bardioc/.agent-logs/upstream-contributions/surrealdb-01-kv-lance-feature-on-sdk.md - Companion: #35 (merged)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds Lance storage backend support to SurrealDB by integrating endpoint type registration, endpoint-to-configuration conversion, and engine-specific connection routing across native and WASM implementations. ChangesLance Backend Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Companion to PR #35 (which forwarded the
kv-lancefeature from the SDK tosurrealdb-core). PR #35 made the feature reachable at the SDK level; this PR adds the actual surface adopters need to USE the Lance backend from the SDK:Lancestruct inengine::local(mirror ofRocksDb, gated bykv-lancefeature)opt/endpoint/lance.rs: endpoint helper that converts paths intolance://URLs (mirror ofrocksdb.rs)opt/endpoint/mod.rs: registermod lance;+LanceEndpointKindvariant +"lance"URL scheme parser armengine/any/native.rs: Lance arm in the connect-by-scheme matchengine/any/wasm.rs: same for wasmPattern is a direct mirror of RocksDb; reviewers can diff the new files against
rocksdb.rs/RocksDb's existing wiring to verify the correspondence.Concrete downstream use (AdaWorldAPI/bardioc substrate-b)
Without this PR, declaring
features = ["kv-lance"]at the SDK level (PR #35) lets thekv-lancebackend compile in viasurrealdb-corebut the SDK exposes noLancestruct + nolance://endpoint helper — so adopters cannot instantiateSurreal::new::<Lance>(...)from SDK-only code. Adopters had to depend directly onsurrealdb-coreOR construct theDatastoreby hand, both of which defeat the SDK's purpose.Tests
The existing RocksDb integration test in
surrealdb/tests/api_integration/mod.rsuses the patternuse surrealdb::engine::local::{Db, RocksDb};. A parallel Lance test follows the same shape — happy to add in a follow-up PR (or in this one if maintainers want it bundled).Provenance
bardioc/.agent-logs/upstream-contributions/surrealdb-01-kv-lance-feature-on-sdk.mdSummary by CodeRabbit
Release Notes
lance://endpoint protocol with flexible configuration options. Live queries and database backup functionality are fully enabled for Lance connections. Lance support is available when thekv-lancefeature is enabled during the build process.