pub trait SqlAccess:
Send
+ Sync
+ 'static {
// Required methods
fn reader<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn SqlReader>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn writer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn SqlWriter>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn atomic_unit<'life0, 'async_trait>(
&'life0 self,
op: AtomicUnitOp,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Any + Send>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Base SQL access capability.
Required Methods§
Sourcefn reader<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn SqlReader>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reader<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn SqlReader>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Acquire a read-only connection from the pool.
Sourcefn writer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn SqlWriter>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn writer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn SqlWriter>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Acquire a read-write connection from the pool.
Sourcefn atomic_unit<'life0, 'async_trait>(
&'life0 self,
op: AtomicUnitOp,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Any + Send>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn atomic_unit<'life0, 'async_trait>(
&'life0 self,
op: AtomicUnitOp,
) -> Pin<Box<dyn Future<Output = StorageResult<Box<dyn Any + Send>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run op as ONE atomic unit of work (ADR-067 Component A, Fork C
slice 2).
Where a single-writer task is active (file-backed pool,
KHIVE_WRITE_QUEUE=1), op runs inside that task’s one write
transaction for this request — no separate connection is opened, so
this call cannot compete with the writer task for SQLite’s write
lock. Where no writer task applies (flag off, no runtime, or an
in-memory pool), op runs under a manual
BEGIN IMMEDIATE/COMMIT/ROLLBACK on a writer handle exactly like
calling Self::writer and driving the statements by hand — the
pre-ADR-067 behavior, preserved byte-for-byte on this path.
The atomic-unit suspend-free invariant (normative for every
caller): op’s future must complete on its first poll — it may
issue only synchronous DML against the &mut dyn SqlWriter it is
handed and must never reach a real suspension point (no embedding
computation, no ANN warming, no service or channel await, no
network round-trip). On the single-writer path this is enforced at
runtime: the writer task drives op through a single-poll driver and
returns a typed error the instant the future is Pending, so a
violation fails loudly rather than corrupting state. On the flag-off
path (no writer task active) a suspending op would currently
succeed — that path drives op as an ordinary .await under a
manual transaction — so the invariant is a correctness contract this
trait asks every caller to uphold, not something the type system or
every code path enforces. Callers must not rely on the flag-off
path’s tolerance; behavior must be identical (synchronous DML only)
regardless of whether the single-writer flag is on.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".