pub struct Counts {
rings: Mutex<HashMap<(String, Option<String>), Ring>>,
}Expand description
Every count this process holds.
Memory only. A restart is a fresh window for every statement, every
account and the deployment, which is plan/policy.md’s
“the reset-on-restart behaviour must be stated rather than discovered”.
BUCKETS counters and a head per account per statement: about 150
bytes with a DID for a key. A statement counting each account on its
own is that much per account; one counting the deployment is that much
once.
Fields§
§rings: Mutex<HashMap<(String, Option<String>), Ring>>Implementations§
Source§impl Counts
impl Counts
Sourcepub fn read(
&self,
counter: &str,
account: Option<&str>,
window: Window,
at: i64,
) -> u64
pub fn read( &self, counter: &str, account: Option<&str>, window: Window, at: i64, ) -> u64
What key holds in window at at.
Sourcepub fn add(&self, counter: &str, account: Option<&str>, at: i64)
pub fn add(&self, counter: &str, account: Option<&str>, at: i64)
Counts one more against key at at.
Sourcepub fn forget(&self, account: &str)
pub fn forget(&self, account: &str)
Drops everything counted against account, whatever statement
counted it.
Sourcepub fn forget_everything(&self)
pub fn forget_everything(&self)
Drops every count, which is what a restart does. Not reachable from any request: nothing on the write path calls it.
fn lock(&self) -> MutexGuard<'_, HashMap<(String, Option<String>), Ring>>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Counts
impl RefUnwindSafe for Counts
impl Send for Counts
impl Sync for Counts
impl Unpin for Counts
impl UnsafeUnpin for Counts
impl UnwindSafe for Counts
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