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.
| Chunked receive | Receives large input in 256 KB-scale chunks so the browser does not carry an unbounded request body. |
|---|---|
| Bounded admission | Limits active jobs and reserved spool bytes before accepting work. |
| Durable spool | Writes admitted payloads locally before the worker executes them. |
| Safe retry | Uses idempotency keys and SHA-256 fingerprints to suppress safe duplicate submissions. |
| Lifecycle | Tracks 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 ↗.
