pub struct MemoryApprovalStore { /* private fields */ }Expand description
An in-process ApprovalStore. Cloning shares the state, so two coordinators over clones
model two threads (or, with a fresh coordinator over the same store, a restart that kept the
durable half). A real restart of the process forgets everything.
Implementations§
Trait Implementations§
Source§impl ApprovalStore for MemoryApprovalStore
impl ApprovalStore for MemoryApprovalStore
Source§fn insert(&self, record: &ApprovalRecord) -> Result<(), StoreError>
fn insert(&self, record: &ApprovalRecord) -> Result<(), StoreError>
Store a new request.
Err(Exists) when the id is taken.fn get(&self, id: &str) -> Result<Option<ApprovalRecord>, StoreError>
Source§fn replace(
&self,
expected_revision: u64,
record: &ApprovalRecord,
) -> Result<(), StoreError>
fn replace( &self, expected_revision: u64, record: &ApprovalRecord, ) -> Result<(), StoreError>
Replace the stored record with
record only if the stored revision equals
expected_revision; Err(Conflict) otherwise, Err(NotFound) for an unknown id.Source§fn list(
&self,
states: &[ApprovalState],
) -> Result<Vec<ApprovalRecord>, StoreError>
fn list( &self, states: &[ApprovalState], ) -> Result<Vec<ApprovalRecord>, StoreError>
Every record in one of
states, oldest first.Source§fn claim_nonce(
&self,
value: &str,
expires_ms: u64,
now_ms: u64,
) -> Result<bool, StoreError>
fn claim_nonce( &self, value: &str, expires_ms: u64, now_ms: u64, ) -> Result<bool, StoreError>
Remember
value until expires_ms. Ok(true) when it was new, Ok(false) when it was
already remembered (a replay). now_ms lets the store forget expired nonces.Source§impl Clone for MemoryApprovalStore
impl Clone for MemoryApprovalStore
Auto Trait Implementations§
impl Freeze for MemoryApprovalStore
impl RefUnwindSafe for MemoryApprovalStore
impl Send for MemoryApprovalStore
impl Sync for MemoryApprovalStore
impl Unpin for MemoryApprovalStore
impl UnsafeUnpin for MemoryApprovalStore
impl UnwindSafe for MemoryApprovalStore
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