pub struct MemoryStore { /* private fields */ }Expand description
An in-process store for tests, examples and development.
Nothing survives the process. Clones share the same data, so a test can drop a runtime and build a new one over the same store to simulate a restart.
Implementations§
Trait Implementations§
Source§impl Clone for MemoryStore
impl Clone for MemoryStore
Source§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§impl EffectStore for MemoryStore
impl EffectStore for MemoryStore
Source§async fn append_late_observation(
&self,
observation: LateObservation,
) -> Result<(), StoreError>
async fn append_late_observation( &self, observation: LateObservation, ) -> Result<(), StoreError>
Appends supplementary evidence without a lease. It must never modify
the effect record or authoritative transition history. Duplicate
observation ids leave the original observation unchanged. The effect
must exist; evidence is deleted atomically when that effect is pruned.
Source§async fn late_observations(
&self,
id: EffectId,
after: Option<EffectId>,
limit: usize,
) -> Result<Vec<LateObservation>, StoreError>
async fn late_observations( &self, id: EffectId, after: Option<EffectId>, limit: usize, ) -> Result<Vec<LateObservation>, StoreError>
Lists untrusted evidence by observation id, with bounded pagination.
Evidence is for operator investigation and never proof of commitment.
Source§async fn insert_or_get(
&self,
new: NewEffect,
) -> Result<InsertOutcome, StoreError>
async fn insert_or_get( &self, new: NewEffect, ) -> Result<InsertOutcome, StoreError>
Source§async fn get(&self, id: EffectId) -> Result<Option<EffectRecord>, StoreError>
async fn get(&self, id: EffectId) -> Result<Option<EffectRecord>, StoreError>
Loads a record by id.
Source§async fn get_by_key(
&self,
key: &EffectKey,
) -> Result<Option<EffectRecord>, StoreError>
async fn get_by_key( &self, key: &EffectKey, ) -> Result<Option<EffectRecord>, StoreError>
Loads a record by its logical identity.
Source§async fn acquire_lease(
&self,
id: EffectId,
owner: &WorkerId,
now: SystemTime,
ttl: Duration,
) -> Result<Lease, StoreError>
async fn acquire_lease( &self, id: EffectId, owner: &WorkerId, now: SystemTime, ttl: Duration, ) -> Result<Lease, StoreError>
Takes the execution lease, via
EffectRecord::acquire_lease.Source§async fn renew_lease(
&self,
lease: &Lease,
now: SystemTime,
ttl: Duration,
) -> Result<Lease, StoreError>
async fn renew_lease( &self, lease: &Lease, now: SystemTime, ttl: Duration, ) -> Result<Lease, StoreError>
Extends a held lease, via
EffectRecord::renew_lease.Source§async fn release_lease(&self, lease: &Lease) -> Result<(), StoreError>
async fn release_lease(&self, lease: &Lease) -> Result<(), StoreError>
Gives up a lease, via
EffectRecord::release_lease. Releasing a
lease that was already lost is not an error.Source§async fn transition(
&self,
request: TransitionRequest,
) -> Result<EffectRecord, StoreError>
async fn transition( &self, request: TransitionRequest, ) -> Result<EffectRecord, StoreError>
Applies a status transition, via
EffectRecord::apply, and appends
its audit event in the same atomic unit. Returns the updated record.Source§async fn list(&self, query: ListQuery) -> Result<Vec<EffectRecord>, StoreError>
async fn list(&self, query: ListQuery) -> Result<Vec<EffectRecord>, StoreError>
Lists records matching
query, ordered by id (creation time).Source§async fn events(&self, id: EffectId) -> Result<Vec<EffectEvent>, StoreError>
async fn events(&self, id: EffectId) -> Result<Vec<EffectEvent>, StoreError>
The audit events of one effect, ordered by sequence.
Source§async fn prune(&self, query: PruneQuery) -> Result<u64, StoreError>
async fn prune(&self, query: PruneQuery) -> Result<u64, StoreError>
Deletes up to
query.limit records matching query, lowest id
first, together with their audit events, and returns how many it
deleted. Each record is checked and deleted atomically, so a record
that a worker leases or changes concurrently is either deleted before
that change or not at all. Read moreAuto Trait Implementations§
impl Forget for MemoryStore
impl Freeze for MemoryStore
impl Move for MemoryStore
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
impl UnwindSafe for MemoryStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more