Skip to main content

MemoryFixture

Struct MemoryFixture 

pub struct MemoryFixture(/* private fields */);
Expand description

The reference Fixture: one MemoryEventStore, any number of handles.

This is the oracle the suite is validated against, and it is also the worked example an adapter author reads before writing their own fixture. Two things in it are worth copying:

  • connect is an Arc clone. A handle owns a refcount into the backing store rather than borrowing a lifetime from the fixture, which is what lets Fixture::Store be an ordinary associated type instead of a GAT. A pool-backed fixture does the same thing with a pool; a !Send fixture does it with an Rc.
  • REOPEN is declined with the real reason. MemoryFixture is the workspace’s first fixture to decline anything, which is what makes the skip machinery non-vacuous — until something declines a capability, “a skip is reported” is a claim about code no fixture executes.

It also states no CF-40 store limit, inheriting None three times, so append_reports_exceeded_store_limits reports a skip against it. That is the honest answer — MemoryEventStore has no ceiling on a payload, a tag count or a batch size — and it is the first rule in the suite the reference fixture cannot run. GappedPositionFixture in the testkit’s own tests/mutation_coverage/variants.rs is the conformant variant that states all three and enforces them, which is what keeps the rule non-vacuous.

Implementations§

§

impl MemoryFixture

pub fn new() -> Self

Creates a fixture over a new, empty MemoryEventStore.

pub fn sharing(store: Arc<MemoryEventStore>) -> Self

Creates a fixture over an existing store, which is a way of deliberately breaking isolation.

This is not a convenience, and it is not what an adapter’s fixture should look like. It exists so that two_fixture_instances_observe_none_of_each_others_appends can be shown to fail: handing every instance the same Arc reproduces, in memory, the file-backed adapter that points every fixture at one temporary path. A rule no implementation can fail is decorative, and this is the implementation that fails this one.

Nothing else in the workspace should call it.

Trait Implementations§

§

impl Debug for MemoryFixture

§

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

Formats the value using the given formatter. Read more
§

impl Default for MemoryFixture

§

fn default() -> Self

Returns the “default value” for a type. Read more
§

impl Fixture for MemoryFixture

§

const SECOND_HANDLE: Capability = Capability::SUPPORTED

Whether this fixture can hand out a second, independent handle onto the one backing store. Read more
§

const REOPEN: Capability

Whether this fixture can be reopened: every outstanding handle’s process-level state discarded, such that a subsequent connect observes only what was durably committed. Read more
§

const MID_BATCH_FAULT: Capability

Whether this fixture can make its store fail part way through writing one batch. Read more
§

const READ_FAULT: Capability

Whether this fixture can make its store fail part way through a read. Read more
§

const HELD_ABOVE_FRONTIER: Capability

Whether this fixture can hold a committed row above ES-10’s visibility frontier: a row the store has committed and read does not yet show. Read more
§

const REMOVAL: Capability

Whether this fixture can remove events from its store outside the port: delete them from the adapter’s own storage, by a mechanism EventStore does not have. Read more
§

type Store = MemoryHandle

A handle onto this fixture’s backing store. Read more
§

fn connect(&self) -> impl Future<Output = Self::Store>

Opens a handle onto this fixture’s backing store. Read more
§

const READ_YOUR_OWN_WRITES: Capability = Capability::SUPPORTED

Whether a read through this store shows an append the same caller has just been told succeeded. Read more
§

const MAX_EVENT_DATA_LEN: Option<usize> = None

The largest data payload this fixture’s store accepts, in bytes, or None if it has no ceiling. Read more
§

const MAX_TAGS_PER_EVENT: Option<usize> = None

The largest number of tags on one event this fixture’s store accepts, or None if it has no ceiling. Read more
§

const MAX_EVENTS_PER_BATCH: Option<usize> = None

The largest number of events this fixture’s store accepts in one append, or None if it has no ceiling. Read more
§

const MAX_METADATA_LEN: Option<usize> = None

The largest metadata on one event this fixture’s store accepts, in bytes, or None if it has no ceiling. Read more
§

const MAX_TAGS_PER_BATCH: Option<usize> = None

The most tags, summed over every event of one append, this fixture’s store accepts, or None if it has no ceiling beyond the one MAX_EVENTS_PER_BATCH × MAX_TAGS_PER_EVENT already implies. Read more
§

fn arm_mid_batch_fault(&self, after: usize) -> impl Future<Output = ()>

Arms the store so that the next append of more than after events fails while writing event after + 1. Read more
§

fn arm_read_fault(&self) -> impl Future<Output = ()>

Arms the store so that the next read fails part way through. Read more
§

fn reopen(&self) -> impl Future<Output = ()>

Closes and reopens the underlying storage, discarding every outstanding handle’s process-level state. Read more
§

fn arm_held_above_frontier(&self) -> impl Future<Output = Armed>

Arms the store so that every append committed after this returns, through any handle, is held above the visibility frontier for the rest of this fixture’s life. It is committed, read and head do not show it, and the store still holds it. Read more
§

fn settle_frontier(&self) -> impl Future<Output = Settled>

Brings this store’s visibility frontier up to everything it holds, and says whether it did. Read more
§

fn remove_outside_port( &self, positions: &[SequencePosition], ) -> impl Future<Output = Removed>

Removes the events this store holds at positions outside EventStore (a raw DELETE on the adapter’s own storage), and says whether it did. 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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<F> ConcurrentFixture for F
where F: Fixture, <F as Fixture>::Store: Send,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V