pub fn ensure_sqlite_memory_shared(
config: &CamelConfig,
) -> Result<(), CamelError>Expand description
Boot-time lint (ungated): rejects per-connection sqlite :memory:
datasource URLs, which give every pooled connection its own private
in-memory database — an INSERT through one connection and a SELECT
through another can hit different databases.
The remediation message names two accepted forms:
- Named shared-memory URI, the scenario-tier convention, e.g.
sqlite:file:memdb_appdb?mode=memory&cache=shared. All pool connections share one named in-memory database; the name is stable across connections and parses with the sqlx driver.sqlite:file:matches no automatic datasource factory prefix (factories matchscheme://orscheme::), so the config must also pinprovider = "sqlx". - Bare shared cache,
sqlite::memory:?cache=shared. Accepted, but each parse gets a sqlx-assigned private name, and pool connections under the Any driver can hold private databases — pinmax_connections = 1with this form.
Iterates config.datasources in BTreeMap order (the config stores a
HashMap, whose iteration order is unspecified) so diagnostics are
deterministic. The error names the datasource only, never its URL
(ADR-0051 credential redaction).