pub struct UsageWindowDescriptor {
pub key: String,
pub scope: UsageWindowScope,
pub meter: UsageWindowMeter,
pub period_start_unix: Option<i64>,
pub boundary_source: UsageWindowBoundarySource,
pub boundary_confidence: UsageWindowBoundaryConfidence,
}Expand description
Stable semantics for one provider-specific quota window.
UsageWindow intentionally stays close to the upstream response. This
descriptor supplies the extra identity and accounting semantics a host
needs to match the same window across refreshes and completed periods.
Fields§
§key: StringStable within one channel. Hosts that combine channels should namespace
this key with Channel::id.
scope: UsageWindowScopeWhich locally recorded traffic is governed by this window.
meter: UsageWindowMeterThe upstream unit represented by used, limit, or used_percent.
period_start_unix: Option<i64>Inclusive period start, when it can be established, in unix seconds.
boundary_source: UsageWindowBoundarySourceHow the period boundary was established.
boundary_confidence: UsageWindowBoundaryConfidenceWhether the complete boundary is exact, derived, partial, or unknown.
Implementations§
Source§impl UsageWindowDescriptor
impl UsageWindowDescriptor
Sourcepub fn from_window(window: &UsageWindow) -> Self
pub fn from_window(window: &UsageWindow) -> Self
Conservative descriptor for a normalized window. Channel adapters can
refine its scope and meter through Channel::describe_usage_window.
pub fn scope(self, scope: UsageWindowScope) -> Self
pub fn meter(self, meter: UsageWindowMeter) -> Self
pub fn period_start( self, unix: i64, source: UsageWindowBoundarySource, confidence: UsageWindowBoundaryConfidence, ) -> Self
Trait Implementations§
Source§impl Clone for UsageWindowDescriptor
impl Clone for UsageWindowDescriptor
Source§fn clone(&self) -> UsageWindowDescriptor
fn clone(&self) -> UsageWindowDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more