Writable VFS: scope write state by database name
Situation
I want to use one registered Litestream VFS with multiple independent SQLite databases.
Each database has:
- its own database name;
- its own configuration;
- its own replica URL;
- its own LTX transaction sequence.
Connections to the same database must share write state. Connections to different databases must not share write state.
Current behavior
PR #1157 added configuration by database name. It also creates a separate ReplicaClient for each configured connection.
This change appears to let one VFS open multiple databases.
However, the write state from PR #1140 is still global to the VFS:
- writeFile
- lastSyncedTXID
As a result, write activity for one database can affect another database.
Questions
Is PR #1157 intended to support multiple writable databases through one VFS?
If yes, can we store the write state in a map that uses the database name as the key?
This would give the following behavior:
- Connections with the same database name share write state.
- Connections with different database names have separate write state.
If this is not the intended design, what is the recommended way to use multiple writable databases in one process?
Source: benbjohnson/litestream