feat(experimental): add async DatabasePool subpath - #102
Open
mceachen wants to merge 3 commits into
Open
Conversation
Expose a fixed-size pool of warm SQLite connections at @photostructure/sqlite/experimental so SQL executes on libuv workers instead of the event loop; the stable root surface is unchanged. Warm connections meet the multi-op/ms target that per-operation opens miss, and the default strict authorizer rejects connection-affine SQL so calls stay correct on any leased connection. See the archived TPP in doc/done/ for the contract and validation evidence.
| } | ||
| if (value.IsNumber()) { | ||
| const double number = value.As<Napi::Number>().DoubleValue(); | ||
| if (std::isfinite(number) && std::trunc(number) == number && |
Comment on lines
+906
to
+909
| if (!response_.error.present && | ||
| !RunSetup(db, state().get(), configuration_.setup, &response_.error)) { | ||
| // Error is already captured. | ||
| } |
| return true; | ||
| } | ||
|
|
||
| int BindValue(sqlite3_stmt *statement, int index, const NativeValue &value) { |
Remove machine-specific raw reports from version control while retaining reproducible commands and summarized evidence.
Avoid deployment-gated variant access and initialize Node-API handles so platform compilers can prove the native paths are safe.
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
DatabasePoolat@photostructure/sqlite/experimental.API and behavior
The pool exposes asynchronous
run,get,all, and explicitbatchoperations over warm connections. Declarative connection setup supports PRAGMAs, attachments, and temporary extension loading before a connection enters the pool.The API deliberately omits connection and statement handles, JavaScript SQLite callbacks, streaming, and transaction callbacks. Transactional work is submitted as one explicit batch, so each job remains valid on any leased connection.
See the experimental API guide and archived technical project plan.
Performance
A documented local reference run recorded multiple operations per millisecond from warm connections and substantial scaling from additional libuv capacity under competing worker-pool load. Generated raw reports remain local and are not versioned. The measurements are evidence, not functional-test timing assertions.
Validation
Post-rebase checks:
The archived plan records the earlier full ESM, unsuppressed LSan, Valgrind, and Alpine Node 22/24/26 runs. In the current sandbox, leak-at-exit checking is blocked by ptrace policy. The current full ESM run also reaches one pre-existing mainline failure in
test/release-load.test.tsbecause it uses__dirname; this branch does not modify that file.