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: u64Latency penalty in microunits per millisecond of p95 latency.
hard_risk_limit_bps: u16Hard risk limit in basis points (requests at or above this are rejected).
minimum_confidence_bps: u16Minimum confidence in basis points (requests below this are rejected).
risk_penalty_multiplier_bps: u16Risk penalty multiplier in basis points.
default_exposure_cap_microcents: i64Default per-tenant exposure cap in microcents (0 = unlimited).
wal_sync_on_append: boolWhether WAL should fsync after every append (durability vs throughput).
max_catalog_size: usizeMaximum models in a single catalog (sanity bound).
Implementations§
Source§impl EngineConfig
impl EngineConfig
Sourcepub fn latency_penalty(self, microunits_per_ms: u64) -> Self
pub fn latency_penalty(self, microunits_per_ms: u64) -> Self
Set latency penalty (microunits per ms).
Sourcepub fn hard_risk_limit(self, bps: u16) -> Self
pub fn hard_risk_limit(self, bps: u16) -> Self
Set hard risk limit (basis points, max 10_000).
Sourcepub fn minimum_confidence(self, bps: u16) -> Self
pub fn minimum_confidence(self, bps: u16) -> Self
Set minimum confidence (basis points, max 10_000).
Sourcepub fn risk_penalty_multiplier(self, bps: u16) -> Self
pub fn risk_penalty_multiplier(self, bps: u16) -> Self
Set risk penalty multiplier (basis points, max 50_000).
Sourcepub fn default_exposure_cap(self, microcents: i64) -> Self
pub fn default_exposure_cap(self, microcents: i64) -> Self
Set default per-tenant exposure cap (0 = unlimited).
Sourcepub fn wal_sync_on_append(self, sync: bool) -> Self
pub fn wal_sync_on_append(self, sync: bool) -> Self
Enable fsync after every WAL append.
Sourcepub fn max_catalog_size(self, size: usize) -> Self
pub fn max_catalog_size(self, size: usize) -> Self
Set maximum catalog size.
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate all fields.
Sourcepub fn ensure_tenant(
&self,
budget: &BudgetEngine,
tenant_id: &str,
initial_microcents: i64,
)
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
impl Clone for EngineConfig
Source§fn clone(&self) -> EngineConfig
fn clone(&self) -> EngineConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more