You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently SQLSync wraps SQLite in order to carefully control how SQLite behaves and improve the user experience of using SQLSync. But this makes SQLSync harder to port to new SQLite environments.
This feature request is to build a version of SQLSync that can run entirely within SQLite as a native extension.
Things to figure out:
What does the mutation/reducer layers look like? If the reducer continues to be Wasm, it can run internally; alternatively SQLSync can somehow call out to the host to run mutations when needed.
How easy is it for SQLSync to have a private timelines table if it's entirely inside the SQLite engine?
Will need to add some pragmas/custom functions to inspect and control SQLSync from the host
The initial goal is to just get a loadable extension that works with the native run-time loadable extension system. This will ideally make SQLSync work with the largest amount of targets.
Then, work can begin on making it easier for folks running in the browser to use SQLite extensions. Some projects/prior work that is relevant to this effort:
It would be very cool to look into dynamically loading extensions at runtime via Wasm dynlinking, and ideally working with https://github.com/nalgeon/sqlean to support a large library of extensions.
SQLite VFS's can implement a IOCAP + FCNTL which signals support for batch atomic writes
need to set the SQLITE_IOCAP_BATCH_ATOMIC bit
During a batch write SQLite will make no other calls on the same file object except for calls to xWrite and xFileControl
this allows the VFS to internally optimize batch writes to the underlying file, but must guarantee that the writes are committed atomically to durable storage (or rolled back completely) upon receiving the COMMIT or ROLLBACK FCNTL's
Activity
carlsverre commentedon Jan 18, 2024
The initial goal is to just get a loadable extension that works with the native run-time loadable extension system. This will ideally make SQLSync work with the largest amount of targets.
Then, work can begin on making it easier for folks running in the browser to use SQLite extensions. Some projects/prior work that is relevant to this effort:
It would be very cool to look into dynamically loading extensions at runtime via Wasm dynlinking, and ideally working with https://github.com/nalgeon/sqlean to support a large library of extensions.
carlsverre commentedon Jan 24, 2024
Research notes as of Jan 24 2024
sqlite-loadable-rs
Just do it manually?
Vlcn bindings
VFS stacking
sqlite3_vfs_find(0)to get the current default VFSSQLite batch write mode (atomic write mode)