Repository navigation
Add Rust bindings for partition routing hooks - #40
Merged
Merged
Conversation
adsharma
force-pushed
the
feat/partition-routing-hooks
branch
from
September 20, 2026 14:21
715d052 to
5cbf81c
Compare
Expose the engine's distributed partition-routing hooks (locate, lifecycle, insertRow/insertChunk, bindScan) through a C-ABI shim plus a safe RoutingGuard API. Writes to claimed partitions land in a bundled row store served back by a per-parent scan function, so install + insert + read forms a complete remote loop. lookupRow stays unset (engine default). The shim compiles against the amalgamated lbug.hpp alone, so no source checkout is needed; the module is always built and requires headers carrying the hooks (prebuilt archives since ladybug #1005). Includes a mock-wrapper round-trip test (point + COPY writes, parent scan, lifecycle, drop).
adsharma
force-pushed
the
feat/partition-routing-hooks
branch
from
September 20, 2026 16:05
5cbf81c to
b148501
Compare
Open
3 tasks
adsharma
force-pushed
the
feat/partition-routing-hooks
branch
from
September 20, 2026 19:41
f2771b2 to
b148501
Compare
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.
Exposes the engine's distributed partition-routing hooks (LadybugDB/ladybug#829) to Rust.
What
include/lbug_partition_routing.h+src/lbug_partition_routing.cpp: C-ABI shim overcommon::PartitionRoutingHooks. Point writes materialize into a per-parent row store (bulk writes fan out row-at-a-time); one scanTableFunctionper parent serves the store back, so install + insert + read is a complete remote loop with no further machinery. All claimed partitions of a parent share one scan function, which the engine requires to collapse the parent scan (divergent scans read as a local/remote mix and are rejected).lookupRowstays unset (engine default: MERGE over claimed partitions errors).src/partition_routing.rs: safe API —RoutingGuard::install(process-global, before opening any Database), placement/lifecycle/write callbacks with decodedValuerows,register_parent_schemafor scan serving. Callbacks must beSend + Sync, must not panic (aborts rather than corrupting engine state); uninstall requires no live Databases.build.rs: the shim needs full engine headers (common/partition_routing_hook.h), which prebuilt archives do not ship. Reuses a sibling ladybug checkout when present (mirrorsLBUG_SOURCE_DIR's../ladybugdefault; CI checks it out there) plus generated headers from its build tree, and compiles the module out otherwise.Tests
New mock-wrapper round-trip test (mirrors the engine's
partition_routing_test.cpp): claims every partition of a HASH table remote, covers point +COPYwrites, parent-union reads through the bundled scan, lifecycle create/drop counts. Full suite green (159 + 3), fmt clean, no new clippy lints.Known engine gap (not this PR)
Claiming a LIST partition is broken engine-side as of 0.20: dynamic LIST creation throws raw
unordered_map::atinstead of routing remotely (the HASH path returns a null table and branches toinsertRow; seegetOrCreatePartitionLocked). The test therefore exercises HASH; LIST works unclaimed (local) as before.