Skip to main content

SqliteEventStore

Struct SqliteEventStore 

pub struct SqliteEventStore { /* private fields */ }
Available on crate feature event-store only.
Expand description

A SQLite-backed event store.

The connection lives behind a Mutex because [rusqlite::Connection] is Send but not Sync: without the mutex, &SqliteEventStore would not be Send, and every future in the SendEventStore flavour captures &self. The mutex is what buys Self: Sync, and Self: Sync is what makes the Send flavour implementable at all. It also means this adapter serialises its writers by construction — that is the shape it is here to represent, not an accident.

The Arc is not for sharing the store; it is so that a SqliteReadStream can outlive the &self borrow that produced it, which it must, because read is not async and hands the stream back to the caller.

Implementations§

§

impl SqliteEventStore

pub const MAX_EVENT_DATA_LEN: usize = 1_048_576

The largest data payload this store accepts, in bytes of Event::data — not of an encoded row, and not of data and metadata together.

A fact about this adapter, not a trade: SQLite’s own ceiling is near a gigabyte, and this is the number below it that keeps the conformance suite runnable, because the rule that checks a ceiling allocates it plus one byte twice per run. It is sixteen times VT-21’s 65,536-byte floor.

pub const MAX_TAGS_PER_EVENT: usize = 128

The largest number of tags on one event this store accepts.

Twice VT-22’s floor of 64. Every tag costs a row in event_tag and an upsert in tag_cardinality, both inside the write transaction, so the number is bounded by lock hold time rather than by storage.

pub const MAX_EVENTS_PER_BATCH: usize = 256

The largest number of events this store accepts in one append.

Twice VT-24’s floor of 128. At this ceiling with MAX_TAGS_PER_EVENT tags on every event, a single multi-row tag insert would bind 98,304 of SQLite’s 32,766 bound parameters — which is why the insert is chunked to the parameter budget and the transaction is not.

pub const MAX_PAGE_BYTES_PER_STATEMENT: usize

How many bytes of event payload one statement of a page may accumulate before it stops taking rows.

A row is not a bounded quantity, and the row budget could not say so. Each row of a page owns its data, up to MAX_EVENT_DATA_LEN, and its metadata, which check_ceilings does not bound at all — so a page bounded only in rows is bounded, in bytes, by SQLite’s own near-gigabyte blob limit rather than by anything this crate states. Measured rather than argued: one page of 512 events at the data ceiling peaked at 537,036,800 live bytes — 512.2 MiB — in one buffer before a single row reached the caller (experiments/one-connection-latency/results/raw/ceiling-residency.txt).

Per statement, which is what the name says and what the bound is. A wide query is several statements merged, so the honest ceiling on one page’s payload residency is this number times planned_statement_count — computable by a caller, which is the point of it being public, and stated here rather than left to be discovered. The alternative, one budget shared across the page, was rejected: the first statement would spend it and every later one would be cut to a single row, which turns a wide query into a page-per-event replay.

It is checked after the row is taken, so a page always makes progress. That is not hypothetical tidiness: metadata is unbounded, so one row can exceed this on its own, and a page that refused it would stall the read forever.

Eight maximal payloads. It is a fact this adapter states, in the sense MAX_EVENT_DATA_LEN is one, and not a measured optimum: it is large enough that a page of maximal events still carries eight of them, and small enough that a page’s cost is stated in megabytes. Whether the pair of budgets should be stated by the adapter at all or asked of the caller is a decision this constant does not make; the brief is staged in .kb/_intake/.

pub const MAX_QUERY_ARMS_PER_STATEMENT: usize = 400

How many index arms one prepared statement carries before the query is split across several.

SQLite compiles a UNION of n arms as one compound SELECT, and SQLITE_MAX_COMPOUND_SELECT defaults to 500 terms. A Query bounds nothing by design — the specification requires every store to evaluate at least 128 items and puts no ceiling above that — so a wide query is chunked and merged, never refused: there is no MAX_QUERY_ITEMS anywhere in this crate and no QueryItems StoreLimit variant to report one through, because a query-item refusal is not an append outcome.

The number is public so that a test can compute the boundary rather than guess at it: a merge that never executes is dead code behind a green suite, which is the failure mode this whole project exists to retire.

It is one of two axes, and it is not the one that binds first on a query of wide items — see MAX_QUERY_PARAMETERS_PER_STATEMENT.

pub const MAX_QUERY_PARAMETERS_PER_STATEMENT: usize = PARAMETER_BUDGET

How many bound parameters one query statement carries before the query is split across several.

SQLite’s SQLITE_MAX_VARIABLE_NUMBER is 32,766, and the translation binds one parameter per tag and one per type of every item in a chunk. So this and MAX_QUERY_ARMS_PER_STATEMENT are independent axes rather than two spellings of one width: 400 items of a single tag each is 400 arms and 400 parameters, while the same 400 items at MAX_TAGS_PER_EVENT tags apiece is still 400 arms and 51,200 parameters. Partitioning on arms alone planned that second query as one statement and prepare refused it with SQLite’s own “too many SQL variables” — on the append path, inside BEGIN IMMEDIATE, with the caller’s decision already made, which is the timing VT-24 rejects by name.

The number is the same budget the multi-row tag insert has chunked to since the write path was written, and it sits below SQLite’s ceiling with headroom rather than at it, for the reason given where it is defined: a statement that binds one extra parameter per row should not be within rounding distance of the wall. A query is not a different kind of statement.

Public for the same reason the arm width is public — a test that has to guess the boundary is a test that stops crossing it — and it is the ceiling tests/wide_tags.rs computes its under, at and over cases from.

pub fn planned_statement_count(query: &Query) -> usize

How many prepared statements one page of query will take.

Never zero: Query::all is one statement, straight to the event table.

This is the seam a test uses to observe a wide query genuinely crossing the boundary, so it is the same call the read path makes — query_sql::page_statements, counted — never a second ceil(arms / width) that would go on reporting a boundary fetch_page had stopped taking. It followed chunks until the read path stopped using it, and moving it was not optional: the two partition identically today, so a count left behind would have agreed by arithmetic rather than by construction and gone on agreeing right up until it mattered.

It counts the real partition, which is both ceilings and not the arm one alone. That changes what the number says for a query of wide items: it used to report 1 for a plan of 51,200 bound parameters, a statement that cannot be prepared. A caller sizing a query against this seam is asking how many statements will run, not how many the arm arithmetic on its own would allow.

Only the shape of the Window below reaches the count, never its values — it is pub(crate), so this says its name rather than linking to it: the partition prices the two bounds every arm binds and the one budget every chunk binds, and is otherwise indifferent to what lo, hi and budget hold. A default Selectivity likewise orders tags inside an arm, never the partition.

pub fn new(connection: Connection) -> Result<Self, SqliteEventStoreError>

Wraps an already-open connection onto an already-migrated database.

The caller is responsible for having applied the schema — use open to have that done — and this constructor is fallible because it is not merely taking the caller’s word for it: the store carries the database’s incarnation, so it reads it back here. A StoreId-less store would mint every EventId under a zero origin, which has no error path and no observable symptom.

The connection is used as it is given. It is not reconfigured, so a caller reaching this constructor directly should have opened it through crate::connection::open_configured, or configured it deliberately. A caller that may meet a file with no store yet, or one a build before schema 2 wrote, wants open_on, which migrates it.

§Errors

pub fn open(path: impl AsRef<Path>) -> Result<Self, SqliteEventStoreError>

Opens (creating if absent) a store at path and applies the schema.

The connection is configured before anything is written to it — WAL, a stated synchronous, and a finite busy timeout — through the one path crate::connection::open_configured both stores in this crate share. Migration is idempotent and safe under a concurrent open: re-opening an already-migrated file adds no schema object and mints no second incarnation.

§Errors
Examples found in repository?
examples/telemetry-across-codecs/src/main.rs (line 99)
98async fn run(path: &Path) -> Result<()> {
99    let events = SqliteEventStore::open(path)?;
100
101    the_version_that_shipped_first(&events).await?;
102    the_upgrade(&events).await?;
103    one_log_two_encodings(&events).await?;
104    one_fold_reads_both(&events).await?;
105
106    println!("\n== final log ==");
107    print_log(&events).await?;
108
109    Ok(())
110}
More examples
Hide additional examples
examples/handles-and-quotas/src/main.rs (line 53)
52async fn run(path: &Path) -> Result<()> {
53    let events = SqliteEventStore::open(path)?;
54
55    the_boundary_is_a_query()?;
56    a_name_is_held_by_one_owner(&events).await?;
57    a_released_name_is_claimable_again(&events).await?;
58    a_plan_caps_what_an_owner_holds(&events).await?;
59    one_command_delivered_twice(&events).await?;
60
61    println!("\n== what the log actually says ==");
62    print_log(&events).await?;
63
64    Ok(())
65}
examples/rebuilding-read-models/src/main.rs (line 154)
153async fn run(path: &Path) -> Result<()> {
154    let events = SqliteEventStore::open(path)?;
155    let models = SqliteProjectionStore::open(path)?;
156    let app = open_configured(path)?;
157    app.execute_batch(READ_MODEL_DDL)?;
158
159    seed_the_log(&events).await?;
160    two_views_two_checkpoints(&events, &models, &app).await?;
161    a_third_view_added_late(&events, &models, &app).await?;
162    reset_and_rebuild(&events, &models, &app).await?;
163    one_poisoned_view(&events, &models).await?;
164
165    writeln!(io::stdout().lock(), "\n== final log ==")?;
166    print_log(&events).await?;
167
168    Ok(())
169}
examples/transfers-on-sqlite/src/main.rs (line 128)
127async fn before_the_reopen(path: &Path) -> Result<()> {
128    let events = SqliteEventStore::open(path)?;
129    let models = SqliteProjectionStore::open(path)?;
130    let app = open_configured(path)?;
131    app.execute_batch(READ_MODEL_DDL)?;
132
133    println!("\n== opening two accounts ==");
134    open_account(&events, "a1").await?;
135    open_account(&events, "a2").await?;
136    println!("   a1 and a2 opened");
137
138    println!("\n== depositing 100 into a1 ==");
139    deposit(&events, "a1", 100).await?;
140    println!("   deposited");
141
142    println!("\n== transferring 40 from a1 to a2 ==");
143    transfer(&events, "a1", "a2", 40).await?;
144    println!("   transferred: one append, two events, both accounts checked");
145
146    println!("\n== transferring 500 from a1 to a2 ==");
147    match transfer(&events, "a1", "a2", 500).await {
148        Ok(()) => bail!("an overdrawn transfer should have been rejected"),
149        Err(err) => println!("   rejected: {err}"),
150    }
151
152    println!("\n== projecting balances into the same file ==");
153    let mut balances = Balances::new();
154    let chunk = Chunk::of(CHUNK.try_into()?);
155    let done = run_projection(&events, &models, &mut balances, &Json, chunk).await?;
156    println!("   applied {} event(s)", done.applied);
157    print_read_model(&app)?;
158
159    Ok(())
160}
161
162/// Everything after the reopen, against the same file.
163///
164/// Nothing is carried in from above but the path.
165async fn after_the_reopen(path: &Path) -> Result<()> {
166    println!("\n== everything above is dropped; reopening the same file ==");
167    let events = SqliteEventStore::open(path)?;
168    let models = SqliteProjectionStore::open(path)?;
169    let app = open_configured(path)?;
170    println!("   reopened");
171
172    println!("\n== the read model, straight off disk ==");
173    print_read_model(&app)?;
174
175    println!("\n== the same balances, folded again from the event log ==");
176    for account in ["a1", "a2"] {
177        let balance = fold_balance(&events, account).await?;
178        println!("   {account}: {}", balance.held);
179    }
180
181    println!("\n== the checkpoint survived too ==");
182    let mut balances = Balances::new();
183    let chunk = Chunk::of(CHUNK.try_into()?);
184    let done = run_projection(&events, &models, &mut balances, &Json, chunk).await?;
185    println!(
186        "   re-running the projection applied {} event(s) — the log is not replayed",
187        done.applied
188    );
189
190    println!("\n== the reopened store is live, not merely readable ==");
191    transfer(&events, "a2", "a1", 15).await?;
192    let done = run_projection(&events, &models, &mut balances, &Json, chunk).await?;
193    println!(
194        "   transferred 15 back, and the projection applied {} event(s)",
195        done.applied
196    );
197    print_read_model(&app)?;
198
199    println!("\n== final log ==");
200    print_log(&events).await?;
201
202    Ok(())
203}
examples/tickets-over-http/src/runner.rs (line 39)
34pub(crate) async fn run(path: PathBuf) -> Result<()> {
35    ensure_schema(&path)?;
36
37    // Built inside the runtime for the reason the API gives: ADR-0022 §9
38    // captures the tokio handle at construction.
39    let events = SqliteEventStore::open(&path)?;
40    let models = SqliteProjectionStore::open(&path)?;
41    let mut view = SeatHolders::new();
42    let chunk = Chunk::of(CHUNK.try_into()?);
43
44    println!("runner started against {}", path.display());
45
46    loop {
47        match run_projection(&events, &models, &mut view, &Json, chunk).await {
48            Ok(progress) => {
49                if progress.applied > 0 {
50                    println!(
51                        "applied {} event(s), through {:?}",
52                        progress.applied, progress.through
53                    );
54                }
55            }
56            // A failure here is reported and retried rather than fatal. The
57            // most likely one by far is `SQLITE_BUSY` surviving the busy
58            // timeout while the API holds the write lock, and a runner that
59            // exited on it would turn a moment of contention into an operator
60            // page. A *decode* failure would be permanent and would spin —
61            // which is why `rebuilding-read-models` exists to show what a
62            // policy for that looks like, and why this one says out loud that
63            // it does not have one.
64            Err(err) => eprintln!("projection pass failed: {err}"),
65        }
66
67        tokio::time::sleep(IDLE).await;
68    }
69}
examples/tickets-over-http/src/api.rs (line 62)
55pub(crate) async fn run(path: PathBuf) -> Result<()> {
56    ensure_schema(&path)?;
57
58    // Both stores are built **inside** the runtime, and that is load-bearing
59    // rather than stylistic: ADR-0022 §9 captures the tokio handle at
60    // construction, so a store built before a runtime exists records `None` and
61    // every read fails with `SqliteEventStoreError::NoRuntime`.
62    let events = SqliteEventStore::open(&path)?;
63    let models = SqliteProjectionStore::open(&path)?;
64
65    // Opening the show is idempotent by refusal: a second process starting
66    // against the same file is told the show is already open, and that is the
67    // correct answer rather than an error to report.
68    drop(open_show(&events, CAPACITY).await);
69
70    let listener = TcpListener::bind(SocketAddr::from(([127, 0, 0, 1], 0))).await?;
71    // The first line of stdout, and a contract with the demo role. Rust's
72    // stdout is line-buffered, so this reaches the pipe before `accept` blocks.
73    println!("listening on {}", listener.local_addr()?);
74
75    // The runner process derives the same id from the same view: the name and
76    // a digest of its query (PS-25). Reading under the bare name would answer
77    // `202` for ever.
78    let checkpoint = checkpoint_id(&SeatHolders::new())?;
79    let state = Arc::new(State {
80        events,
81        models,
82        checkpoint,
83        path,
84    });
85
86    loop {
87        let (stream, _) = listener.accept().await?;
88        let state = Arc::clone(&state);
89        tokio::spawn(async move {
90            if let Err(err) = serve(&state, stream).await {
91                eprintln!("connection failed: {err}");
92            }
93        });
94    }
95}

pub fn open_on(connection: Connection) -> Result<Self, SqliteEventStoreError>

Applies the schema on a connection the caller opened, configured and keeps, and wraps it.

open without its configuration step. No pragma is set: the journal mode, synchronous, the busy timeout and user_version are left as the caller set them, so a file kept in journal_mode = TRUNCATE — where WAL’s shared-memory file cannot live — stays there. This crate’s schema version is a row in its own store_meta table, never user_version, which stays the caller’s.

Use it in place of new when the file may not hold a store yet: new reads an existing schema and refuses a file without one. On a file that already holds a store it changes nothing and reads the identity back, exactly as open does.

What open configures becomes the caller’s to choose. In particular, with no busy timeout set, a write that meets a lock held by another connection is refused at once rather than waited for.

§Errors

The connection is consumed, as new consumes it, and is closed on any of these; a caller that retries opens it again.

pub fn open_in_memory() -> Result<Self, SqliteEventStoreError>

Opens a private in-memory store and applies the schema.

A convenience for a single-handle caller, and not what a Fixture should reach for: a private in-memory database is per-connection, so a second connect would open a second, empty database rather than a second handle onto this one. WAL has nothing to switch to here, so this connection runs under the journal mode SQLite keeps for memory databases.

§Errors

Returns SqliteEventStoreError::Sqlite if SQLite refuses the connection or the schema cannot be applied, and the identity errors open documents.

pub const fn store_id(&self) -> StoreId

The incarnation this store mints identities under.

The same value before and after a close-and-reopen of the file, which is what makes reopened_store_does_not_reissue_an_event_id askable: with the incarnation held fixed, the position is what must never repeat, and AUTOINCREMENT is the mechanism.

Examples found in repository?
examples/two-devices-one-seat/src/readback.rs (line 36)
32    async fn read(dir: &Path, at: Place, show: &ShowId) -> Result<Self, StoryError> {
33        let site = Site::open(dir, at)?;
34        let log = site.log(at).await?;
35        Ok(Self {
36            store: site.events.store_id(),
37            ids: log.iter().map(|event| event.id).collect(),
38            refunds: log
39                .iter()
40                .filter(|event| event.event_type() == &SALE_REFUNDED)
41                .map(|event| event.id)
42                .collect(),
43            view: site.view(show)?,
44        })
45    }

pub fn settings(&self) -> Result<ConnectionSettings, SqliteEventStoreError>

What this handle’s connection is actually running under.

The values are read off the live connection rather than restated from the constants that set them: SQLite silently accepts a pragma it does not recognise, so a statement that executed is not a setting that took.

§Errors

pub fn remint_identity( path: impl AsRef<Path>, ) -> Result<StoreId, SqliteEventStoreError>

Replaces the database’s persisted incarnation with a freshly minted one.

§When a deployment invokes this

After restoring this file from a backup, or after copying it. This adapter mints its incarnation once, at schema creation, and reads it back on every open — the mechanism VT-6 permits only for an adapter that can detect its state was restored or cloned, or whose deployment is documented to invoke a re-mint. A SQLite file copied from Friday’s backup is undetectable from inside SQLite, so this operation is the second half of that permission rather than a convenience: without it, mint-once here would not be legitimate and this adapter would owe a fresh incarnation on every open.

Two copies of one file that keep one incarnation are two stores minting EventIds that collide — a failure with no error path and no observable symptom until a replication peer sees the same identity twice.

Run it with nothing else holding the database open, and before the restored copy accepts its first append: events already in the file keep the origin they were stamped with, which is correct — they were written by the incarnation that is being retired.

§Errors

pub fn remint_identity_on( connection: &mut Connection, ) -> Result<StoreId, SqliteEventStoreError>

remint_identity on a connection the caller opened, configured and keeps.

The same re-mint, under the same procedure — nothing else holding the database open, and before the copy accepts its first append — for a caller that cannot let the path form reconfigure its file. No pragma is set: the journal mode, synchronous, the busy timeout and user_version are left as the caller set them, so a file kept in journal_mode = TRUNCATE stays there. The path form switches it to WAL.

The connection is borrowed rather than consumed because the natural next step is new on it, which reads the fresh identity back. A store already wrapping another connection onto this file goes on holding the retired identity, and refuses its next append with IdentityMoved.

The schema is applied first if the file has none, as open_on applies it.

§Errors

Trait Implementations§

§

impl Clone for SqliteEventStore

§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for SqliteEventStore

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl SendEventStore for SqliteEventStore

§

async fn append( &self, events: &[Event], condition: Option<&AppendCondition>, ) -> Result<SequencePosition, AppendError<Self::Error>>

Appends events, refusing the write if condition is violated.

The body is mostly order, and the order is the specification rather than a style: two of its four steps decide what happens before any SQL runs, and the fourth decides that everything remaining happens inside exactly one BEGIN IMMEDIATE transaction — the write lock taken before the condition is read and held to commit, so the snapshot the guard sees is the snapshot the insert writes into and no second writer can fit between the two halves.

A probe followed by an unrelated insert is the wrong implementation this whole port exists to reject: it passes every single-threaded rule forever, and fails only when two writers decide from the same state.

Returns the position assigned to the last event of this batch, in slice order — never the store head, which is a different number the moment another connection commits.

§Errors

Named by condition rather than by type:

  • the batch was empty — decided first, before the condition is read, because rebuild the decision model and retry is not advice a caller can act on for an empty batch;
  • one event’s data was larger than MAX_EVENT_DATA_LEN, one event carried more tags than MAX_TAGS_PER_EVENT, or the batch held more events than MAX_EVENTS_PER_BATCH — each reported as a capacity refusal carrying the magnitude that exceeded it, never as a store failure and never by truncating, so that a caller can tell this will never fit here from the disk is full, retry;
  • a guard of the condition matched an event strictly after its boundary, in which case the transaction rolls back and the file is unchanged;
  • the write lock was not acquired before the configured busy timeout elapsed — SQLITE_BUSY or SQLITE_LOCKED from BEGIN IMMEDIATE — which is reported as AppendError::Busy: contention, before any statement of this append ran, so nothing was written and deciding again is safe. It is neither a condition violation nor a store failure;
  • the driver failed in any other way, a busy code raised after BEGIN IMMEDIATE succeeded included, which is AppendError::Store;
  • another thread panicked while holding this store’s connection.
§

async fn head(&self) -> Result<Option<SequencePosition>, Self::Error>

The highest position any reader can currently observe, or None on an empty store.

Asked of the database every time, and that is the whole of it. What this must never become is a field the store caches and append updates: one file backs several handles, so a second connection would then report a head that predates the first connection’s commit — the stale head ES-30 exists to reject, and the defect a single-handle test cannot see.

§Errors
  • another thread panicked while holding this store’s connection;
  • the driver failed, or a stored position is not one the contract can represent.
§

async fn contains_event_id(&self, id: EventId) -> Result<bool, Self::Error>

Whether this store already holds the event id names.

The probe seeks the UNIQUE (origin_store, origin_position) index migration 1 created — one constraint serving two jobs: this lookup, and the guard that keeps ingest from storing one event twice.

§Errors
  • another thread panicked while holding this store’s connection;
  • the driver failed.
§

type Error = SqliteEventStoreError

How this adapter fails for its own reasons. Read more
§

fn read( &self, query: &Query, options: ReadOptions, ) -> impl Stream<Item = Result<SequencedEvent, Self::Error>> + Send

Reads the events matching query, in the order options asks for. Read more
§

impl SendIngestStore for SqliteEventStore

Available on crate feature sync only.
§

async fn store_id(&self) -> Result<StoreId, Self::Error>

Never fails: the identity was read when the store was opened.

§

type Error = SqliteEventStoreError

How this store fails, stating a class so a runner never infers one.
§

async fn ingest( &self, groups: &[IngestGroup<'_>], ) -> Result<Ingested, IngestError<Self::Error>>

Records events other stores minted, preserving their identity, together with any compensation this side writes for them. Read more
§

async fn watermark(&self) -> Result<Watermark, Self::Error>

The highest origin position this store holds from each origin store. Read more
§

impl SendWriteGroupStore for SqliteEventStore

Available on crate feature sync only.

The log in the writes that made it (SY-39), from the columns migration 2 added: what a runner pushes from and a StoreSyncPeer serves a pull from. The Send flavour, for the reason the impl above gives.

§

type Error = SqliteEventStoreError

How this store fails, stating a class so a runner never infers one.
§

async fn read_groups( &self, after: Option<SequencePosition>, max_events: NonZeroUsize, ) -> Result<GroupPage, Self::Error>

The write groups whose first position is above after (every group when None), in ascending first order, each whole. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<TraitVariantBlanketType> EventStore for TraitVariantBlanketType
where TraitVariantBlanketType: SendEventStore,

Source§

type Error = <TraitVariantBlanketType as SendEventStore>::Error

How this adapter fails for its own reasons. Read more
Source§

fn read( &self, query: &Query, options: ReadOptions, ) -> impl Stream<Item = Result<SequencedEvent, <TraitVariantBlanketType as EventStore>::Error>>

Reads the events matching query, in the order options asks for. Read more
Source§

async fn append( &self, events: &[Event], condition: Option<&AppendCondition>, ) -> Result<SequencePosition, AppendError<<TraitVariantBlanketType as EventStore>::Error>>

Atomically appends events, rejecting the write if condition matches. Read more
Source§

async fn head( &self, ) -> Result<Option<SequencePosition>, <TraitVariantBlanketType as EventStore>::Error>

The highest position currently visible in the store, or None when it holds nothing. Read more
Source§

async fn contains_event_id( &self, id: EventId, ) -> Result<bool, <TraitVariantBlanketType as EventStore>::Error>

Whether this store holds an event with id. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<TraitVariantBlanketType> IngestStore for TraitVariantBlanketType
where TraitVariantBlanketType: SendIngestStore,

Source§

type Error = <TraitVariantBlanketType as SendIngestStore>::Error

How this store fails, stating a class so a runner never infers one.
Source§

async fn store_id( &self, ) -> Result<StoreId, <TraitVariantBlanketType as IngestStore>::Error>

This store’s own incarnation identifier. Read more
Source§

async fn ingest( &self, groups: &[IngestGroup<'_>], ) -> Result<Ingested, IngestError<<TraitVariantBlanketType as IngestStore>::Error>>

Records events other stores minted, preserving their identity, together with any compensation this side writes for them. Read more
Source§

async fn watermark( &self, ) -> Result<Watermark, <TraitVariantBlanketType as IngestStore>::Error>

The highest origin position this store holds from each origin store. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<TraitVariantBlanketType> WriteGroupStore for TraitVariantBlanketType
where TraitVariantBlanketType: SendWriteGroupStore,

Source§

type Error = <TraitVariantBlanketType as SendWriteGroupStore>::Error

How this store fails, stating a class so a runner never infers one.
Source§

async fn read_groups( &self, after: Option<SequencePosition>, max_events: NonZero<usize>, ) -> Result<GroupPage, <TraitVariantBlanketType as WriteGroupStore>::Error>

The write groups whose first position is above after (every group when None), in ascending first order, each whole. Read more