pub struct MemoryStore(/* private fields */);Expand description
Everything in memory: for development, tests and single-process demos. Expired approvals are dropped a day after they expire; nothing else is ever dropped, and nothing survives a restart.
Implementations§
Source§impl MemoryStore
impl MemoryStore
Trait Implementations§
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§impl Store for MemoryStore
impl Store for MemoryStore
Source§fn binding<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
jkt: &'life2 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Person>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn binding<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
jkt: &'life2 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Person>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The person an agent key is bound to.
Source§fn bind<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
jkt: &'life2 str,
person: &'life3 Person,
) -> Pin<Box<dyn Future<Output = StoreResult<Person>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn bind<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
jkt: &'life2 str,
person: &'life3 Person,
) -> Pin<Box<dyn Future<Output = StoreResult<Person>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Bind a key to a person unless it is bound already; returns whoever it is bound to.
Source§fn mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The mission
s256 names.Source§fn insert_mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
mission: &'life2 Mission,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn insert_mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
mission: &'life2 Mission,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save a newly approved mission, unless one with its hash exists.
Returns whether it did: an existing mission is never replaced.
Source§fn log_mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
entry: LogEntry,
now: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn log_mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
entry: LogEntry,
now: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Append
entry to a live mission’s log. Returns whether it was live.Source§fn end_mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
at: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn end_mission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
at: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Mark a mission completed at
at, unless it already was. Returns the
mission, or None when there is no such mission.Source§fn spend<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
amount: u64,
rule: Spend,
now: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn spend<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
s256: &'life2 str,
amount: u64,
rule: Spend,
now: i64,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Add
amount to a live mission’s spend, under rule. Returns the
mission as spent, or None when it was not live or amount did not fit.Source§fn missions<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn missions<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<Mission>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The tenant’s missions, for the management routes.
Source§fn approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Approval>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<Approval>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The approval
id names.Source§fn insert_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
approval: &'life2 Approval,
) -> Pin<Box<dyn Future<Output = StoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn insert_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
approval: &'life2 Approval,
) -> Pin<Box<dyn Future<Output = StoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save a new approval.
Source§fn transition_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
expected: ApprovalStatus,
next: &'life2 Approval,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn transition_approval<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
expected: ApprovalStatus,
next: &'life2 Approval,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Replace approval
next.id with next, only if its status is still
expected. Returns whether it did.Auto Trait Implementations§
impl !Freeze 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