pub struct FloorState {
pub max_issued: u64,
pub hw: u64,
}Expand description
Floor state for one grant key.
Fields§
§max_issued: u64Highest issued_at among accepted grants (0 = none yet).
hw: u64Highest capped local now seen (the persisted high-water mark).
Implementations§
Source§impl FloorState
impl FloorState
Sourcepub fn effective_now(&self, now: u64) -> u64
pub fn effective_now(&self, now: u64) -> u64
The time to judge expiry by.
Sourcepub fn observe(&mut self, now: u64)
pub fn observe(&mut self, now: u64)
Record the local clock: hw = max(hw, min(now, max_issued + 30 d)).
Nothing is recorded while no grant has been accepted. Never lowers hw.
Sourcepub fn note_issued(&mut self, issued_at: u64)
pub fn note_issued(&mut self, issued_at: u64)
Record an accepted grant’s issued_at.
Trait Implementations§
Source§impl Clone for FloorState
impl Clone for FloorState
impl Copy for FloorState
Source§impl Debug for FloorState
impl Debug for FloorState
Source§impl Default for FloorState
impl Default for FloorState
Source§impl<'de> Deserialize<'de> for FloorState
impl<'de> Deserialize<'de> for FloorState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FloorState
Source§impl PartialEq for FloorState
impl PartialEq for FloorState
Source§impl Serialize for FloorState
impl Serialize for FloorState
impl StructuralPartialEq for FloorState
Auto Trait Implementations§
impl Freeze for FloorState
impl RefUnwindSafe for FloorState
impl Send for FloorState
impl Sync for FloorState
impl Unpin for FloorState
impl UnsafeUnpin for FloorState
impl UnwindSafe for FloorState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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