pub struct RateLimited {
pub requested: u64,
pub available: u64,
pub ops_per_sec: u64,
pub burst: u64,
}Expand description
Returned by TenantContext::try_acquire_op /
TenantContext::try_acquire_ops when a tenant has exhausted its
time-windowed operation-rate budget.
Distinct from the byte-cap errors (TensorWasmError::MemoryExhausted /
GpuMemoryExhausted), which are high-water-mark capacity refusals: a
rate-limit refusal is transient — the same request will succeed once the
token bucket refills. The struct carries enough context for a scheduler to
back off intelligently (how many tokens were asked for, how many were
available, and the configured steady-state rate) and is deliberately a
crate-local type rather than a new TensorWasmError variant: the rate
limiter is an additive, opt-in noisy-neighbour control that this crate owns
end-to-end, and tensor-wasm-core (which owns TensorWasmError) is a
separate component this crate must not edit.
Fields§
§requested: u64Tokens (operations) the caller requested.
available: u64Tokens available in the bucket at the moment of refusal (after the
time-based refill was applied). Always < requested.
ops_per_sec: u64Configured steady-state refill rate in tokens per second
(ops_per_sec passed to TenantContextBuilder::with_rate_limit).
burst: u64Configured bucket depth (burst passed to
TenantContextBuilder::with_rate_limit).
Trait Implementations§
Source§impl Clone for RateLimited
impl Clone for RateLimited
Source§fn clone(&self) -> RateLimited
fn clone(&self) -> RateLimited
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RateLimited
Source§impl Debug for RateLimited
impl Debug for RateLimited
Source§impl Display for RateLimited
impl Display for RateLimited
impl Eq for RateLimited
Source§impl Error for RateLimited
impl Error for RateLimited
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for RateLimited
impl PartialEq for RateLimited
Source§fn eq(&self, other: &RateLimited) -> bool
fn eq(&self, other: &RateLimited) -> bool
self and other values to be equal, and is used by ==.