pub struct SqliteLog { /* private fields */ }Expand description
A log in a single SQLite file.
docs/07 §7.8.1 gives the reason, and it is not speed:
SQLite is also a read-model engine, so “append and project in one transaction” — the property
Postgres gives production — becomes available on a laptop. redb cannot offer that at any
speed, because it has no query language for a projection to be written in.
The connection is behind a Mutex rather than a pool. One writer is the invariant §3.7 already
depends on, and SQLite serialises writers anyway; a pool would add contention to model
concurrency the log does not have.
Implementations§
Source§impl SqliteLog
impl SqliteLog
Sourcepub fn open(path: &Path) -> Result<SqliteLog>
pub fn open(path: &Path) -> Result<SqliteLog>
Open a log that makes the same durability promise redb and Postgres do.
pub fn open_with(path: &Path, durability: Durability) -> Result<SqliteLog>
Sourcepub fn in_memory() -> Result<SqliteLog>
pub fn in_memory() -> Result<SqliteLog>
A log that never touches a disk — the same engine and the same SQL, for tests.
Durability is meaningless here and the strong setting is still passed, so an in-memory run and an on-disk run differ in exactly one thing: the disk.
Sourcepub fn truncate(&self) -> Result<()>
pub fn truncate(&self) -> Result<()>
Drop and recreate the log — the counterpart of PgLog::truncate.
Trait Implementations§
Source§impl LogStore for SqliteLog
impl LogStore for SqliteLog
Source§fn kind(&self) -> &'static str
fn kind(&self) -> &'static str
fn head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Seq>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn floor<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Seq>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
batch: &'life1 [Pending],
) -> Pin<Box<dyn Future<Output = Result<Vec<Envelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
batch: &'life1 [Pending],
) -> Pin<Box<dyn Future<Output = Result<Vec<Envelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
seqs. Returns the stamped envelopes.