pub struct MemoryDecisionStore {
inner: RwLock<Inner>,
per_account: usize,
total: usize,
arrivals: Arc<Notify>,
epoch: String,
}Expand description
The in-process decision store.
Fields§
§inner: RwLock<Inner>§per_account: usize§total: usize§arrivals: Arc<Notify>§epoch: StringImplementations§
Trait Implementations§
Source§impl Debug for MemoryDecisionStore
impl Debug for MemoryDecisionStore
Source§impl DecisionStore for MemoryDecisionStore
impl DecisionStore for MemoryDecisionStore
Source§fn put(&self, record: DecisionRecord) -> Result<Stored, DecisionRefused>
fn put(&self, record: DecisionRecord) -> Result<Stored, DecisionRefused>
Stores a freshly minted record, assigning its
sequence and its
first_time, and hands back what was stored. Read moreSource§fn check_room(&self) -> Result<(), DecisionRefused>
fn check_room(&self) -> Result<(), DecisionRefused>
Whether the server-wide bound has room right now, without writing
anything and without checking any account’s own bound — there is no
account to check one against here. Read more
Source§fn get(&self, request_uri: &str) -> Option<DecisionRecord>
fn get(&self, request_uri: &str) -> Option<DecisionRecord>
One record by the pushed request it decides, whatever state it is in.
Source§fn by_token(&self, token: &str) -> Option<DecisionRecord>
fn by_token(&self, token: &str) -> Option<DecisionRecord>
One record by the token that approves it, if that token is still the
token of a live record.
Source§fn pending_for(
&self,
account: &str,
cursor: Option<&str>,
) -> (Vec<DecisionRecord>, String)
fn pending_for( &self, account: &str, cursor: Option<&str>, ) -> (Vec<DecisionRecord>, String)
This account’s live records that arrived after
cursor, oldest
first, and the cursor a caller should send next. Read moreSource§fn settle(
&self,
request_uri: &str,
state: DecisionState,
) -> Option<DecisionRecord>
fn settle( &self, request_uri: &str, state: DecisionState, ) -> Option<DecisionRecord>
Moves a live record out of
DecisionState::Pending, returning it as
it was just before. None if it is unknown, expired or already
settled — which is what makes an approval single-use even before the
consent reference is consumed. Read moreSource§fn approve(
&self,
request_uri: &str,
redirect: Option<String>,
) -> Option<DecisionRecord>
fn approve( &self, request_uri: &str, redirect: Option<String>, ) -> Option<DecisionRecord>
DecisionStore::settles a live record as
DecisionState::Approved and holds redirect for a browser signed
in as the account, in one step, so no load of the page finds the
approval without it.Source§fn holds(&self, request_uri: &str) -> bool
fn holds(&self, request_uri: &str) -> bool
Whether an approval holds a redirect for a browser.
Source§fn collect(&self, request_uri: &str) -> Option<String>
fn collect(&self, request_uri: &str) -> Option<String>
Hands over the redirect an approval held for a browser, once.
Source§fn sweep(&self, now: OffsetDateTime)
fn sweep(&self, now: OffsetDateTime)
Drops every record whose pushed request has expired, answered or not,
and the redirect it held.
Source§fn arrivals(&self) -> Arc<Notify> ⓘ
fn arrivals(&self) -> Arc<Notify> ⓘ
Woken every time a record arrives, so a long poll does not have to
spin.
Source§fn remember(
&self,
account: &str,
client_key: &ClientKey,
client_id: &str,
granted: ScopeSet,
now: OffsetDateTime,
)
fn remember( &self, account: &str, client_key: &ClientKey, client_id: &str, granted: ScopeSet, now: OffsetDateTime, )
Remembers the account’s approval of
client_key at granted, until
REMEMBERED_TTL from now. Replaces the one it had, rather than
merging scopes into it.Source§fn remembered(
&self,
account: &str,
client_key: &ClientKey,
now: OffsetDateTime,
) -> Option<Remembered>
fn remembered( &self, account: &str, client_key: &ClientKey, now: OffsetDateTime, ) -> Option<Remembered>
The account’s live remembered approval of
client_key, if any.Source§fn forget_client(&self, client_id: &str, account: Option<&str>) -> usize
fn forget_client(&self, client_id: &str, account: Option<&str>) -> usize
Forgets the remembered approvals of
client_id, on account or on
every account, and says how many it forgot.Source§fn forget_account(&self, account: &str)
fn forget_account(&self, account: &str)
Forgets every remembered approval the account made.
Source§fn forget_all(&self)
fn forget_all(&self)
Forgets every remembered approval.
Auto Trait Implementations§
impl !Freeze for MemoryDecisionStore
impl RefUnwindSafe for MemoryDecisionStore
impl Send for MemoryDecisionStore
impl Sync for MemoryDecisionStore
impl Unpin for MemoryDecisionStore
impl UnsafeUnpin for MemoryDecisionStore
impl UnwindSafe for MemoryDecisionStore
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more