Repository navigation
feat: Stoolap support + Driver trait refactor (0.19.0) - #61
Merged
Merged
Conversation
Replace the DriverKind enum with a Driver trait that each database implements alongside its Datasource: URL schemes, sqlparser dialect, identifier quoting, autocomplete functions, SQL-literal rendering for :export sql, and connect(). Drivers are registered in DRIVERS, so adding a database no longer touches code outside src/datasource/.
Embedded, in-process driver for Stoolap (stoolap:./dir, stoolap::memory:). User statements run on a dedicated session executor that carries BEGIN…COMMIT across execute() calls; introspection uses SHOW TABLES / SHOW VIEWS / DESCRIBE / SHOW INDEXES on a separate auto-commit handle. Cancel fires stoolap's cancellation flag and moves the session to a fresh executor, since the engine doesn't poll the flag inside joins. stoolap is pinned to =0.4.2 with default features off (they install a jemalloc global allocator and the stoolap CLI).
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
DriverKindenum is gone. Each database now implements aDrivertrait in its own module: URL schemes, sqlparser dialect, identifier quoting, autocomplete functions,:export sqlliteral rendering, andconnect()→Datasource. Drivers are registered inDRIVERS. Adding a database no longer requires changes outsidesrc/datasource/. The connection-form hint is generated from the registry, so it now also lists thepostgresql:alias.stoolap:./data/mydb,stoolap::memory:). Stoolap is embedded and in-process, and is called through its synchronous API on the blocking pool.BEGIN … COMMITacrossexecute()calls.SHOW TABLES/SHOW VIEWS/DESCRIBE/SHOW INDEXESon a separate auto-commit handle. Views fall back toSELECT * … LIMIT 0for column names.INSERT … RETURNINGrows are shown.stoolapis pinned to=0.4.2(pre-1.0, breaking minor releases) with default features off. The defaults install a jemalloc#[global_allocator]and the stoolap CLI. It adds 26 crates and changes no existing versions.Known limitations (documented in README)
main. Views report no column types, and primary keys aren't listed as indices.Test plan
cargo fmt && cargo clippy --all-targets -- -D warnings && cargo test: 674 tests pass locally, including 8 new stoolap tests (introspection, cell decoding, transactions across calls, reset rollback, file persistence + lock release, URL parsing) and 3 new driver-registry testsstoolap:connection, Ctrl+T test showed ✓ Connected, ran CREATE/INSERT/SELECT (int/text/JSON/timestamp/NULL render), and expanded the schema tree down to columns with types:export sqlon a stoolap result, then re-import it into a freshstoolap::memory::cancelon a long stoolap join, then confirm the next statement runs immediately