Replies: 1 comment 1 reply
-
|
I wonder if it is possible to do this with a VFS. Rather than two separate SQLite instances, can the VFS make this split for us? Questions:
Possibility:
This is still a problem for reads... LiveStore assumes synchronous reads. We'd need a way to load all data for reads into memory ahead of time. Maybe this can be driven by the routing library. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
LiveStore aims to provide a 100% synchronous API for data access from the UI thread in the browser. The problem, however, is if you ever go to disk from the UI thread the browser forces the call to be async. This means LiveStore needs to create a second copy of the database stored entirely in-memory. This in-memory copy lazily persists to the canonical copy on disk. In other words, writes are not durably committed.
All writes flow from the memory-db to the disk db. No writes flow from the worker to the memory DB — the full copy of the disk db is pulled into the memory db at startup.
This in-memory DB is hydrated once from disk at app startup.
Benefits
Complications
This design creates a few complications for:
Alternative Designs
Beta Was this translation helpful? Give feedback.
All reactions