Module sahpool_vfs

Module sahpool_vfs 

Source
Expand description

opfs-sahpool vfs implementation, ported from sqlite-wasm.

See opfs-sahpool for details.

use sqlite_wasm_rs::{
    self as ffi,
    sahpool_vfs::{install as install_opfs_sahpool, OpfsSAHPoolCfg},
};

async fn open_db() {
    // install opfs-sahpool persistent vfs and set as default vfs
    install_opfs_sahpool(&OpfsSAHPoolCfg::default(), true)
        .await
        .unwrap();

    // open with opfs-sahpool vfs
    let mut db = std::ptr::null_mut();
    let ret = unsafe {
        ffi::sqlite3_open_v2(
            c"opfs-sahpool.db".as_ptr().cast(),
            &mut db as *mut _,
            ffi::SQLITE_OPEN_READWRITE | ffi::SQLITE_OPEN_CREATE,
            std::ptr::null()
        )
    };
    assert_eq!(ffi::SQLITE_OK, ret);
}

The VFS is based on FileSystemSyncAccessHandle read and write, and you can install the opfs-explorer plugin to browse files.

Structs§

OpfsSAHPoolCfg
OpfsSAHPool options
OpfsSAHPoolCfgBuilder
Build OpfsSAHPoolCfg
OpfsSAHPoolUtil
SAHPoolVfs management tool.

Enums§

OpfsSAHError

Functions§

install
Register opfs-sahpool vfs and return a management tool which can be used to perform basic administration of the file pool.