Skip to main content

MemoryStore

Struct MemoryStore 

Source
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

Source

pub fn new() -> Self

An empty store.

Trait Implementations§

Source§

impl Default for MemoryStore

Source§

fn default() -> Self

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

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

Replace approval next.id with next, only if its status is still expected. Returns whether it did.
Source§

fn approvals<'life0, 'life1, 'async_trait>( &'life0 self, tenant: &'life1 str, ) -> Pin<Box<dyn Future<Output = StoreResult<Vec<Approval>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The tenant’s approvals, for the management routes.

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more