mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-16 14:44:21 +01:00
This PR eliminates blocking IO calls (`io.block` / `io.wait_for_completion`) from common execution paths I need this because I am trying to make turso in browser work smoothly and current paradigm doesn't work well as it use same connection from different threads. But, in order to run DB on main thread only (expect IO) - we need to eliminate all blocking calls (they block main thread and it can't exit from this state). This PR eliminates blocking behaviour from following places: 1. `append_frames` now fully async but `prepare_wal_start` / `prepare_wal_finish` must be called before it in order to ensure that WAL header is initialized 2. `op_transaction` is non-blocking and read db header async 3. `op_sorter_open` is non-blocking and read db header async in the beginnig of execution 4. `op_open_ephemeral` is non-blocking and read db header async in the beginning of execution (note, that I am also removed weird logic which read page size from the empty ephemeral DB file) 5. `op_checkpoint` is non blocking and checkpoint itself now have more complex state machine to handle previously blocking behaviour Closes #3179