Skip to main content

BudgetConfig

Struct BudgetConfig 

Source
pub struct BudgetConfig {
    pub enabled: bool,
    pub mode: BudgetMode,
    pub budget_per_sec_cap: Option<f64>,
    pub budget_per_sec_floor: Option<f64>,
    pub budget_fraction: f64,
    pub default_capacity_per_sec: f64,
    pub early_flush_fill_ratio: f64,
    pub early_flush_cooldown: Duration,
    pub early_flush_max_queued_bytes: usize,
    pub early_flush_idle: Duration,
    pub admission_timeout: Duration,
}
Expand description

Configuration for the media-ops budget controller.

Fields§

§enabled: bool

Master switch. Default true (Fjord-first).

§mode: BudgetMode

How deadline flushes interact with an empty token bucket.

§budget_per_sec_cap: Option<f64>

Hard cap on durable ops/sec (None = no hard cap beyond capacity×fraction).

§budget_per_sec_floor: Option<f64>

Soft floor on effective budget when set (must be ≤ cap).

§budget_fraction: f64

Fraction of capacity used as soft budget target.

§default_capacity_per_sec: f64

Capacity when no probe/EWMA is available (S3 default path).

§early_flush_fill_ratio: f64

Token fill ratio above which early-flush (effective linger = 0) is allowed.

§early_flush_cooldown: Duration

Suppress consecutive early-flushes for this long after one fires.

§early_flush_max_queued_bytes: usize

Early-flush only when the mutable queue holds at most this many bytes. Combined with Self::early_flush_idle: bulk continuous ingest should not early-flush. 0 disables the byte gate (idle gate may still apply).

§early_flush_idle: Duration

Early-flush only if no produce has been enqueued for at least this long (true idle). Sustained produce keeps resetting the timer so bulk waits full linger / flush. ZERO disables the idle gate.

§admission_timeout: Duration

Max wait for tokens under BudgetMode::BudgetPriority.

Implementations§

Source§

impl BudgetConfig

Source

pub fn validate(&self) -> Result<(), String>

Validate floor ≤ cap when both set.

Source

pub fn effective_budget_per_sec( &self, startup_capacity: Option<f64>, ongoing_capacity: Option<f64>, ) -> f64

Compute effective durable_ops/sec from optional measurements.

Trait Implementations§

Source§

impl Clone for BudgetConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BudgetConfig

Source§

impl Debug for BudgetConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BudgetConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.