AsaDB logo mark AsaDB

Prolog Language SQL Engine

Local-first database software

Official Home Page

Bridge and queue

Reservoir Bridge

A bounded, durable handoff between AsAPanel and the existing SQL executor.

Reservoir is implemented in src/bridge/reservoir.pl. It is not a second database or transaction manager; it controls pressure at the JavaScript-to-Prolog boundary before SQL enters the normal engine path.

large write / SQL upload ↓ admission limits + durable local spool ↓ single Reservoir worker ↓ existing SQL parser and executor ↓ record manager / B+Tree / buffer pool / pages
Chunked receiveReceives large input in 256 KB-scale chunks so the browser does not carry an unbounded request body.
Bounded admissionLimits active jobs and reserved spool bytes before accepting work.
Durable spoolWrites admitted payloads locally before the worker executes them.
Safe retryUses idempotency keys and SHA-256 fingerprints to suppress safe duplicate submissions.
LifecycleTracks progress, cancellation, result paging, queue statistics, TTL cleanup, and restart recovery.

Important failure rule

Queued jobs can survive restart, but interrupted in-flight writes are deliberately not replayed automatically because replay could duplicate a partially committed command. Small read-only queries continue through the direct low-latency path.

Limits such as job count, spool bytes, retention, progress quantum, and result-page size are configured in src/asadb_config.pl. Defaults include 16 jobs and 512 MiB reserved spool capacity.

For the authoritative state machine, failure model, configuration, and localhost API contract, read docs/reservoir.md.