Skip to main content

online_backup

Function online_backup 

Source
async fn online_backup(
    src_pool: &SqlitePool,
    dest_path: &Path,
) -> Result<(), Error>
Expand description

Creates an online backup of src_pool at dest_path.

Uses the SQLite online backup API so the source database remains open and WAL state is handled automatically.

The backup step loop is synchronous but runs directly in the async task rather than inside spawn_blocking. The locked handles guarantee that SQLx’s background worker is not using these connections during the backup, and the borrow checker cannot move both a connection and its borrowed handle into a spawn_blocking closure.