Skip to content

feat: Stoolap support + Driver trait refactor (0.19.0) - #61

Merged
killertux merged 3 commits into
mainfrom
feat/stoolap
Oct 13, 2026
Merged

killertux merged 3 commits into
mainfrom
feat/stoolap

Conversation

@killertux

@killertux killertux commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Driver trait refactor. The DriverKind enum is gone. Each database now implements a Driver trait in its own module: URL schemes, sqlparser dialect, identifier quoting, autocomplete functions, :export sql literal rendering, and connect() → Datasource. Drivers are registered in DRIVERS. Adding a database no longer requires changes outside src/datasource/. The connection-form hint is generated from the registry, so it now also lists the postgresql: alias.
  • Stoolap driver (stoolap:./data/mydb, stoolap::memory:). Stoolap is embedded and in-process, and is called through its synchronous API on the blocking pool.
    • Transactions: user statements run on a dedicated session executor that keeps BEGIN … COMMIT across execute() calls.
    • Introspection: runs SHOW TABLES / SHOW VIEWS / DESCRIBE / SHOW INDEXES on a separate auto-commit handle. Views fall back to SELECT * … LIMIT 0 for column names.
    • Results: the engine's column list decides rows vs. affected count, so INSERT … RETURNING rows are shown.
    • Cancel: fires stoolap's cancellation flag and also moves the session to a fresh executor. The engine doesn't check the flag inside joins, so without the swap the next statement would queue behind a runaway query. Any open transaction is rolled back, same as a Postgres cancel.
    • Dependency: stoolap is 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.
  • Bump to 0.19.0 (minor: new database support).

Known limitations (documented in README)

  • Cancel can't stop a statement stoolap doesn't check (e.g. joins). The statement keeps running on its abandoned executor until it finishes.
  • Stoolap locks the database directory, so rowdy and another process can't open the same database at once.
  • There are no catalogs or schemas: tables show under a single 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 tests
  • Manual (tmux, throwaway HOME): created a stoolap: 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
  • Manual: :export sql on a stoolap result, then re-import it into a fresh stoolap::memory:
  • Manual: :cancel on a long stoolap join, then confirm the next statement runs immediately

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).
@killertux
killertux merged commit f8676ba into main Oct 13, 2026
3 checks passed
@killertux
killertux deleted the feat/stoolap branch October 13, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant