Skip to main content

EngineConfig

Struct EngineConfig 

Source
pub struct EngineConfig {
    pub latency_penalty_microunits_per_ms: u64,
    pub hard_risk_limit_bps: u16,
    pub minimum_confidence_bps: u16,
    pub risk_penalty_multiplier_bps: u16,
    pub default_exposure_cap_microcents: i64,
    pub wal_sync_on_append: bool,
    pub max_catalog_size: usize,
}
Expand description

Runtime configuration for the decision engine.

All fields have safe defaults via Default. Use the builder methods to override only what you need:

use calybris_core::config::EngineConfig;

let config = EngineConfig::new()
    .latency_penalty(5)
    .default_exposure_cap(500_000_000)
    .wal_sync_on_append(true);

Fields§

§latency_penalty_microunits_per_ms: u64

Latency penalty in microunits per millisecond of p95 latency.

§hard_risk_limit_bps: u16

Hard risk limit in basis points (requests at or above this are rejected).

§minimum_confidence_bps: u16

Minimum confidence in basis points (requests below this are rejected).

§risk_penalty_multiplier_bps: u16

Risk penalty multiplier in basis points.

§default_exposure_cap_microcents: i64

Default per-tenant exposure cap in microcents (0 = unlimited).

§wal_sync_on_append: bool

Whether WAL should fsync after every append (durability vs throughput).

§max_catalog_size: usize

Maximum models in a single catalog (sanity bound).

Implementations§

Source§

impl EngineConfig

Source

pub fn new() -> Self

Create a config with safe defaults.

Source

pub fn latency_penalty(self, microunits_per_ms: u64) -> Self

Set latency penalty (microunits per ms).

Source

pub fn hard_risk_limit(self, bps: u16) -> Self

Set hard risk limit (basis points, max 10_000).

Source

pub fn minimum_confidence(self, bps: u16) -> Self

Set minimum confidence (basis points, max 10_000).

Source

pub fn risk_penalty_multiplier(self, bps: u16) -> Self

Set risk penalty multiplier (basis points, max 50_000).

Source

pub fn default_exposure_cap(self, microcents: i64) -> Self

Set default per-tenant exposure cap (0 = unlimited).

Source

pub fn wal_sync_on_append(self, sync: bool) -> Self

Enable fsync after every WAL append.

Source

pub fn max_catalog_size(self, size: usize) -> Self

Set maximum catalog size.

Source

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

Validate all fields.

Source

pub fn ensure_tenant( &self, budget: &BudgetEngine, tenant_id: &str, initial_microcents: i64, )

Initialize a tenant on a crate::budget::BudgetEngine with config-driven defaults.

Applies default_exposure_cap_microcents if set (> 0).

Trait Implementations§

Source§

impl Clone for EngineConfig

Source§

fn clone(&self) -> EngineConfig

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 Debug for EngineConfig

Source§

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

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

impl Default for EngineConfig

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> Same for T

Source§

type Output = T

Should always be Self
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, <T as TryFrom<U>>::Error>

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.