Update the VFS to use imported functions, provided by a small wrapper, using the Deno file-system apis.
Pros:
gain strong no-corrupt databases guarantees given by SQLite (this is a big one)
fast + automatic file-saving on database action
ability to work with databases large enough to not fit into memory (this is a big one)
module would be more in-line with what most people expect when using SQLite modules in other languages (see e.g. #50)
Cons:
won't be able to utilise direct WASM imports in Deno in the future (this is one of the original reasons against such a design)
queries perform synchronous file-system writes (unless they use a :memory: database)
this could be mitigated by also providing an AsyncDB version (or maybe a SyncDB as the base and DB is async), which wraps the other DB and runs it in a worker, sending queries there, returning the queries etc
nice APIs we have right now (pre-load in-memory db, grab db memory directly) will be harder to implement
these may be slower than currently (since right now everything is in-memory, avoiding any re-direction), and it may be hard to implement the .data() api with the new VFS (currently it's easy, since we hold the file data in memory at a location controlled by us)
requires breaking API changes
but those are mostly constraint to how the DB is opened (and with the constructor being new DB(path = ":memory:"), we can even preserve how in-memory DBs are opened)
if these changes are made we should notify our dependents
Proposed API changes
drop open
drop save
drop DB.data()
change constructor new DB(path = ":memory:")
List of dependents to notify of the changes (and discuss changes with)
Idea
Update the VFS to use imported functions, provided by a small wrapper, using the Deno file-system apis.
Pros:
Cons:
:memory:
database).data()
api with the new VFS (currently it's easy, since we hold the file data in memory at a location controlled by us)new DB(path = ":memory:")
, we can even preserve how in-memory DBs are opened)Proposed API changes
open
save
DB.data()
new DB(path = ":memory:")
List of dependents to notify of the changes (and discuss changes with)