Module memory_ingest
memory only.Expand description
An in-memory store that both appends and ingests, behind the memory
feature: the oracle the ingest family is proven against.
§Why it exists: three jobs, one type
The three jobs MemorySyncPeer does, one port over:
- The oracle.
happenstance-sync-testkit’s ingest family is pointed at this store first. A rule red here is a wrong rule, not a wrong store. - The doctest target. An example that needs a store which ingests uses this one, so it runs rather than merely compiles.
- Something to test against. A runner can be written and tested before
any adapter implements
IngestStore.
§Why it is not MemoryEventStore
MemoryEventStore lives in happenstance-core, and its only &self writer
is append, which mints. Coherence lets this crate add a trait to it and
never lets it reach inside (see ingest), so the oracle
owns its log. It is built from happenstance-core’s public API alone, and
what it can take from the reference store it takes rather than copies:
- Its incarnation.
MemoryIngestStore::newuses the identifier a freshMemoryEventStorewould mint, so two oracles never share aStoreId. - Its clock. A local append and a compensation are stamped by
MemoryEventStore::with_events, so the seam that keeps that store total onwasm32-unknown-unknown, which has no clock, is not copied here. - Its error.
MemoryStoreError, which is uninhabited, serves both ports, so “the in-memory store cannot fail” has one name.
What it cannot take is read’s filter chain, which is duplicated. The
event-store suite and a differential test against MemoryEventStore
hold the copy to the original.
It is not built for scale. Every read snapshots under the lock, and every membership question is a set lookup over everything held.
Structs§
- Memory
Ingest Store - An in-memory
EventStorethat is also anIngestStore.