Expand description
§sqlite-objs - SQLite VFS backed by Azure Blob Storage
This crate provides safe Rust bindings to sqlite-objs, a SQLite VFS (Virtual File System) that stores database files in Azure Blob Storage.
§Features
- Store SQLite databases in Azure Blob Storage (page blobs for DB, block blobs for journal)
- Blob lease-based locking for safe concurrent access
- Full-blob caching for performance
- SAS token and Shared Key authentication
- URI-based per-database configuration
§Usage
§Basic Registration (Environment Variables)
use sqlite_objs::SqliteObjsVfs;
use rusqlite::Connection;
// Register VFS from environment variables
SqliteObjsVfs::register(false)?;
// Open a database using the sqlite-objs VFS
let conn = Connection::open_with_flags_and_vfs(
"mydb.db",
rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE | rusqlite::OpenFlags::SQLITE_OPEN_CREATE,
"sqlite-objs"
)?;§URI Mode (Per-Database Credentials)
use sqlite_objs::{SqliteObjsVfs, UriBuilder};
use rusqlite::Connection;
// Register VFS in URI mode (no global config)
SqliteObjsVfs::register_uri(false)?;
// Build URI with proper URL encoding
let uri = UriBuilder::new("mydb.db", "myaccount", "databases")
.sas_token("sv=2024-08-04&ss=b&srt=sco&sp=rwdlacyx&se=2026-01-01T00:00:00Z&sig=abc123")
.cache_dir("/var/cache/myapp")
.cache_reuse(true)
.build();
// Open database with Azure credentials in URI
let conn = Connection::open_with_flags_and_vfs(
&uri,
rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE | rusqlite::OpenFlags::SQLITE_OPEN_CREATE | rusqlite::OpenFlags::SQLITE_OPEN_URI,
"sqlite-objs"
)?;§Explicit Configuration
use sqlite_objs::{SqliteObjsVfs, SqliteObjsConfig};
use rusqlite::Connection;
let config = SqliteObjsConfig {
account: "myaccount".to_string(),
container: "databases".to_string(),
sas_token: Some("sv=2024-08-04&...".to_string()),
account_key: None,
endpoint: None,
};
SqliteObjsVfs::register_with_config(&config, false)?;
let conn = Connection::open_with_flags_and_vfs(
"mydb.db",
rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE | rusqlite::OpenFlags::SQLITE_OPEN_CREATE,
"sqlite-objs"
)?;Modules§
- metrics
- Strongly-typed VFS activity metrics.
Structs§
- Sqlite
Objs Config - Configuration for the sqlite-objs VFS.
- Sqlite
Objs Vfs - Handle to the sqlite-objs VFS.
- UriBuilder
- Builder for constructing sqlite-objs URIs with proper URL encoding.
Enums§
- Prefetch
Mode - Controls how the VFS prefetches blob data on open.
- Sqlite
Objs Error - Error type for sqlite-objs operations.
Type Aliases§
- Result
- Result type for sqlite-objs operations.