feat(index): support xabi scalar index plugins#7203
Draft
Xuanwo wants to merge 5 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds scalar index plugin support on top of
xabi, allowing Lance to load session-scoped index implementations from dynamic libraries without making plugins depend on Lance internals.xabiis used as the stable ABI layer between Lance and plugins. In this model,#[xabi::data]defines versioned wire data types, and#[xabi::xabi]defines trait contracts that are lowered into C-compatible vtables, handles, borrowed references, futures, and owned byte buffers. Lance and a plugin communicate through those generated ABI contracts instead of Rust trait objects from the same crate build. Larger payloads stay format-oriented: Arrow data crosses the boundary as Arrow IPC, and query expressions cross as Substrait bytes plus host-side JSON context.The Lance session now owns plugin registrations and exposes scalar index integration through the existing index registry. A fixture mock btree plugin lives outside the workspace as a test-only xabi dynamic library, so the end-to-end dynamic loading path is covered without adding another published crate.
Reviewing the ABI
The concrete ABI should be reviewed in these files:
rust/lance-index-plugin-abi/src/lib.rsABI_VERSION#[xabi::data]request/response structs#[xabi::xabi]traits for plugin, index, training data, index store, and build progressrust/lance-index-plugin-abi/xabi/snapshots/lance.*/*.txtThe host-side adapter is in
rust/lance/src/session/xabi_index_plugin.rs, and the test plugin implementation is inrust/lance/tests/xabi_plugins/mock_btree/src/lib.rs.ABI stability
The ABI stability story is intentionally centered on xabi rather than Lance internals:
lance.*contract IDs and an explicitABI_VERSION.xabi-assertsnapshots lock the generated ABI layout; intentional ABI changes require updating the snapshots.