mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
The bypass-registry open variants existed so a few callers could open a second Database instance for one file (the sync engine's revert WAL, a wal-copy test) without the process-wide registry handing back the canonical instance. Model that directly instead of as a bypass flag: add Database::do_open_async (and the conn_raw_api-gated sync do_open) that never consult the registry and are the only entry points that honor OpenOptions::wal_path. The registry-aware open/open_async reject wal_path with InvalidArgument, because the registry keys on the default WAL for a path; a registered instance reading a nonstandard WAL would be handed to a later plain open of the same path. open_async now inlines the registry lookup/register logic and funnels the actual open, along with the raw path, through one internal worker that releases the schema guard on failure. Convert the two callers (sync-engine revert-db open, wal-copy test) and delete open_with_flags_bypass_registry and open_with_flags_bypass_registry_async. Tests: open() rejects wal_path; do_open opens a distinct instance and does not register itself over the canonical one. cargo test -p turso_core; turso_sync_engine --lib; core_tester wal_api/database; clippy --workspace --all-features --all-targets clean