Skip to main content

ic_sqlite_vfs/
lib.rs

1//! IC canister crate root for the `icstable` SQLite VFS.
2//!
3//! The database image is stored inside a MemoryManager-compatible virtual
4//! memory. SQLite reaches it only through `sqlite3_vfs` callbacks, so no POSIX
5//! or WASI filesystem is used.
6
7#[cfg(all(feature = "sqlite-bundled", feature = "sqlite-precompiled"))]
8compile_error!("features `sqlite-bundled` and `sqlite-precompiled` cannot be enabled together");
9
10#[cfg(feature = "canister-api")]
11pub mod api;
12pub mod config;
13pub mod db;
14#[cfg(any(test, debug_assertions, feature = "bench-profile"))]
15#[doc(hidden)]
16pub mod read_metrics;
17#[doc(hidden)]
18pub mod sqlite_vfs;
19#[doc(hidden)]
20pub mod stable;
21
22pub use db::{Db, DbError, DbHandle};
23pub use stable::memory::DbMemory;
24pub use stable::memory_manager::{MemoryId, MemoryManager, MemoryManagerInitError};
25pub use stable::raw_memory::DefaultMemoryImpl;
26
27#[macro_export]
28macro_rules! params {
29    () => {
30        &[]
31    };
32    ($($value:expr),+ $(,)?) => {
33        &[$($crate::db::value::to_sql_ref(&$value)),+]
34    };
35}
36
37#[macro_export]
38macro_rules! named_params {
39    () => {
40        &[]
41    };
42    ($($name:expr => $value:expr),+ $(,)?) => {
43        &[$(($name, $crate::db::value::to_sql_ref(&$value))),+]
44    };
45}
46
47#[cfg(feature = "canister-api")]
48use api::{ChecksumRefresh, DbMeta};
49
50#[cfg(feature = "canister-api")]
51ic_cdk::export_candid!();