pub struct CoTenantSqlite { /* private fields */ }Expand description
The co-tenant connection handle — the thin wrapper over the rusqlite connection that the sqlite registry adapter and the refs layer both consume (alkgit owns its tables and its connection, co-tenant beside the engine-owned schemas on the same file — alkblobs ADR-013 §3’s composition posture).
Construction is the assembly-time fallible surface: the open,
the WAL/NORMAL/busy-timeout pinning, and the full
construction-time migration run all fail loudly into
OpenError — a half-migrated store refuses
service (ADR-024 §1). The connection is shared under a
short-held lock; consumers run their blocking SQL under
CoTenantSqlite::lock, bridged off the async executor per
the composition’s concurrency model (the trait impls’
spawn_blocking home).
Implementations§
Source§impl CoTenantSqlite
impl CoTenantSqlite
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, OpenError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, OpenError>
Open the co-tenant connection at path — the same file the
alkstore engine was opened at — run the migrations, and
return the handle. In-memory paths are rejected: :memory:
confers no co-tenancy (per-connection databases; WAL cannot
engage) — ephemeral assemblies compose the mem engines
(substrate.md §assembly shapes, DQ-7).
Sourcepub fn lock(&self) -> MutexGuard<'_, Connection>
pub fn lock(&self) -> MutexGuard<'_, Connection>
Hold the connection for blocking SQL work. The guard is short-held — one statement batch or transaction per hold, bridged off the async executor by the caller.
Sourcepub fn stamp(&self) -> Result<i64, OpenError>
pub fn stamp(&self) -> Result<i64, OpenError>
The store’s current co-tenant schema stamp — the version support and diagnostics report (an ADR-024 consequence: a real version to report). 0 means no step applied yet; a value beyond the shipped step set is the safe unknown-forward coexistence shape (ADR-024 §4).
Sourcepub fn step_count() -> usize
pub fn step_count() -> usize
The shipped step count — the highest stamp this binary’s
step set owns (an honest coexistence datum beside
CoTenantSqlite::stamp).