Skip to main content

MemoryProjectionHandle

Struct MemoryProjectionHandle 

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

One handle onto a MemoryProjectionFixture’s store.

MemoryHandle’s counterpart, and a newtype for the same coherence reason: impl ProjectionStore for Arc<S> is very likely error[E0119] against the blanket impl trait_variant emits, so a shared handle has to be a distinct type that delegates.

It implements SendProjectionStore rather than merely ProjectionStore, because MemoryProjectionStore is a native, thread-safe store and a handle that quietly weakened that would stop exercising the flavour the reference implementation claims. The suite still binds the weaker flavour: the blanket impl is what carries this handle into it.

Implementations§

§

impl MemoryProjectionHandle

pub fn new(store: Arc<MemoryProjectionStore>) -> Self

Wraps a shared store as one handle onto it.

Public so that an adapter author writing their own fixture has the whole reference implementation in front of them rather than most of it: the doctest on ProjectionFixture builds one.

Trait Implementations§

§

impl Clone for MemoryProjectionHandle

§

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 MemoryProjectionHandle

§

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

Formats the value using the given formatter. Read more
§

impl ProjectionProbe for MemoryProjectionHandle

§

const READS_THROUGH_BATCH: bool = true

true, delegated in spirit from the store: MemoryProjectionStore applies on write, so a batch can be read back through before it commits.

Spelled as a literal rather than as <MemoryProjectionStore as ProjectionProbe>::READS_THROUGH_BATCH because an associated const cannot be delegated in a way a reader can check at a glance, and the two are one line apart in the same workspace.

§

async fn probe_write( &self, batch: &mut Self::Batch, key: &str, value: u64, ) -> Result<(), Self::Error>

Writes one probe row into an open batch. Read more
§

async fn probe_delete_all( &self, batch: &mut Self::Batch, ) -> Result<(), Self::Error>

Queues deletion of every probe row into an open batch. Read more
§

async fn probe_read(&self, key: &str) -> Result<Option<u64>, Self::Error>

Reads one probe row from the committed read model. Read more
§

async fn probe_read_through( &self, batch: &mut Self::Batch, key: &str, ) -> Result<Option<u64>, Self::Error>

Reads one probe row through an open batch, committed state included. Read more
§

impl SendProjectionStore for MemoryProjectionHandle

§

type Error = <MemoryProjectionStore as SendProjectionStore>::Error

How this adapter fails.
§

type Batch = <MemoryProjectionStore as SendProjectionStore>::Batch

The adapter’s write set. Read more
§

async fn begin(&self) -> Result<Self::Batch, Self::Error>

Opens a write set. Read more
§

async fn checkpoint(&self, id: &ProjectionId) -> Result<Checkpoint, Self::Error>

How far this projection has been brought, and whether its rows are authoritative. Read more
§

async fn commit( &self, batch: Self::Batch, id: &ProjectionId, position: SequencePosition, authority: Authority, ) -> Result<(), CommitError<Self::Error>>

Applies batch and moves id’s checkpoint to position, as one unit. Read more
§

async fn reset( &self, batch: Self::Batch, id: &ProjectionId, ) -> Result<(), ResetError<Self::Error>>

Applies batch and returns id to Checkpoint::NeverRun, as one unit. Read more
§

async fn rollback(&self, batch: Self::Batch) -> Result<(), Self::Error>

Discards the batch without committing. 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,

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

Source§

impl<TraitVariantBlanketType> ProjectionStore for TraitVariantBlanketType
where TraitVariantBlanketType: SendProjectionStore,

Source§

type Error = <TraitVariantBlanketType as SendProjectionStore>::Error

How this adapter fails.
Source§

type Batch = <TraitVariantBlanketType as SendProjectionStore>::Batch

The adapter’s write set. Read more
Source§

async fn begin( &self, ) -> Result<<TraitVariantBlanketType as ProjectionStore>::Batch, <TraitVariantBlanketType as ProjectionStore>::Error>

Opens a write set. Read more
Source§

async fn checkpoint( &self, id: &ProjectionId, ) -> Result<Checkpoint, <TraitVariantBlanketType as ProjectionStore>::Error>

How far this projection has been brought, and whether its rows are authoritative. Read more
Source§

async fn commit( &self, batch: <TraitVariantBlanketType as ProjectionStore>::Batch, id: &ProjectionId, position: SequencePosition, authority: Authority, ) -> Result<(), CommitError<<TraitVariantBlanketType as ProjectionStore>::Error>>

Applies batch and moves id’s checkpoint to position, as one unit. Read more
Source§

async fn reset( &self, batch: <TraitVariantBlanketType as ProjectionStore>::Batch, id: &ProjectionId, ) -> Result<(), ResetError<<TraitVariantBlanketType as ProjectionStore>::Error>>

Applies batch and returns id to Checkpoint::NeverRun, as one unit. Read more
Source§

async fn rollback( &self, batch: <TraitVariantBlanketType as ProjectionStore>::Batch, ) -> Result<(), <TraitVariantBlanketType as ProjectionStore>::Error>

Discards the batch without committing. Read more
§

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

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

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

§

fn vzip(self) -> V