pub struct UsageReads { /* private fields */ }Expand description
See the module docs. process_table is the one production instance.
Implementations§
Source§impl UsageReads
impl UsageReads
Sourcepub fn held_at(
&self,
key: &str,
now_ms: u64,
) -> Option<(TransientReadFailure, u64)>
pub fn held_at( &self, key: &str, now_ms: u64, ) -> Option<(TransientReadFailure, u64)>
The active hold for key: its failure and when it ends.
Sourcepub fn record_at(
&self,
key: &str,
fetched: Fetched,
now_ms: u64,
) -> Result<(UsageSnapshot, SeatIdentity), ReadError>
pub fn record_at( &self, key: &str, fetched: Fetched, now_ms: u64, ) -> Result<(UsageSnapshot, SeatIdentity), ReadError>
Record one network read for key at now_ms and classify it.
Sourcepub fn last_good_for(
&self,
key: &str,
current: &SeatIdentity,
) -> Option<UsageSnapshot>
pub fn last_good_for( &self, key: &str, current: &SeatIdentity, ) -> Option<UsageSnapshot>
The slot’s last successful snapshot, if it was read from the account
now stored in the slot (current): never another account’s reading.
Sourcepub fn forget_last_good(&self, key: &str)
pub fn forget_last_good(&self, key: &str)
Drop the slot’s last good reading (e.g. after a reported limit).
Sourcepub fn forget(&self, key: &str)
pub fn forget(&self, key: &str)
Drop the slot’s hold and last good reading (synaps auth state --clear): the next read goes to the network. The gate stays, so a
read in flight keeps its single flight; if one is in flight, its
result is still recorded when it lands.
Sourcepub async fn read<F, Fut>(
&self,
key: &str,
fetch: F,
) -> (Result<(UsageSnapshot, SeatIdentity), ReadError>, ReadPath)
pub async fn read<F, Fut>( &self, key: &str, fetch: F, ) -> (Result<(UsageSnapshot, SeatIdentity), ReadError>, ReadPath)
Read key: a held failure is returned without a request; otherwise
one flight per key, and a reader that waited for a flight takes its
result.
Trait Implementations§
Source§impl Default for UsageReads
impl Default for UsageReads
Source§fn default() -> UsageReads
fn default() -> UsageReads
Auto Trait Implementations§
impl !Freeze for UsageReads
impl RefUnwindSafe for UsageReads
impl Send for UsageReads
impl Sync for UsageReads
impl Unpin for UsageReads
impl UnsafeUnpin for UsageReads
impl UnwindSafe for UsageReads
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.