#[non_exhaustive]pub struct RateLimits { /* private fields */ }Expand description
Process-wide rate limits. Hard-coded; not configurable.
Construct only via RateLimits::HARD_CODED. The struct fields are
pub(crate) so downstream code cannot synthesize a RateLimits with
different values, which would weaken docs/LEGAL.md §6 safeguard 8.
Implementations§
Source§impl RateLimits
impl RateLimits
Sourcepub const HARD_CODED: Self
pub const HARD_CODED: Self
The single, hard-coded set of rate limits. There is no other public constructor — see the type-level docs.
Sourcepub const fn max_concurrent_fetches(&self) -> u32
pub const fn max_concurrent_fetches(&self) -> u32
Maximum number of concurrent fetches in flight.
Sourcepub const fn max_fetches_per_second(&self) -> f32
pub const fn max_fetches_per_second(&self) -> f32
Maximum fetch attempts per second across all sources.
Sourcepub const fn per_source_backoff_ms(&self) -> u64
pub const fn per_source_backoff_ms(&self) -> u64
Per-source backoff in milliseconds between consecutive requests.
The floor that applies to every source. A source whose vendor
publishes something stricter gets that instead – see
Self::backoff_ms_for.
Sourcepub fn backoff_ms_for(&self, source: &str) -> u64
pub fn backoff_ms_for(&self, source: &str) -> u64
The minimum gap between two requests to source, in milliseconds.
Self::per_source_backoff_ms unless SOURCE_RATE_OVERRIDES
names a stricter value, in which case the stricter one wins. Never
looser: docs/SOURCES.md promises doiget adopts a stricter vendor
guideline at the per-source level rather than relaxing the global
cap, and max here is what makes that promise structural instead of
a matter of getting every table entry right.
Sourcepub fn max_concurrent_for(&self, source: &str) -> u32
pub fn max_concurrent_for(&self, source: &str) -> u32
The concurrency ceiling for source.
Clamped to Self::max_concurrent_fetches, so a table entry can
only ever tighten the global cap.
Trait Implementations§
Source§impl Clone for RateLimits
impl Clone for RateLimits
Source§fn clone(&self) -> RateLimits
fn clone(&self) -> RateLimits
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more