pub struct AppState {
pub financial_state: Arc<RwLock<FinancialState>>,
pub auth_config: Arc<AuthConfig>,
pub facilitator_stats: Arc<FacilitatorStatsCounter>,
pub facilitator_fee_bps: u32,
pub credit_scores: Arc<RwLock<HashMap<String, CreditScore>>>,
pub credit_lines: Arc<RwLock<HashMap<String, CreditLine>>>,
pub trust_contexts: Arc<RwLock<HashMap<String, TrustContext>>>,
pub payment_histories: Arc<RwLock<HashMap<String, PaymentHistory>>>,
pub outcome_state: Arc<RwLock<OutcomePricingState>>,
pub outcome_engine: Arc<RwLock<OutcomeEngine>>,
pub insurance_state: Arc<RwLock<InsuranceState>>,
}Expand description
Shared application state for the Haima API.
Fields§
§financial_state: Arc<RwLock<FinancialState>>§auth_config: Arc<AuthConfig>§facilitator_stats: Arc<FacilitatorStatsCounter>In-memory facilitator statistics counter.
facilitator_fee_bps: u32Facilitator fee in basis points.
credit_scores: Arc<RwLock<HashMap<String, CreditScore>>>In-memory credit score cache, keyed by agent_id.
credit_lines: Arc<RwLock<HashMap<String, CreditLine>>>In-memory credit lines, keyed by agent_id.
trust_contexts: Arc<RwLock<HashMap<String, TrustContext>>>In-memory trust context cache, keyed by agent_id (from Autonomic).
payment_histories: Arc<RwLock<HashMap<String, PaymentHistory>>>In-memory payment history cache, keyed by agent_id.
outcome_state: Arc<RwLock<OutcomePricingState>>Outcome-based pricing state (contracts, task stats, pending tasks).
outcome_engine: Arc<RwLock<OutcomeEngine>>Outcome pricing engine (contract → verify → bill → refund orchestrator).
insurance_state: Arc<RwLock<InsuranceState>>Insurance marketplace state (products, policies, claims, pool).
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(auth_config: AuthConfig) -> Self
pub fn new(auth_config: AuthConfig) -> Self
Create a new AppState with the given auth config and default financial state.
Sourcepub fn with_insurance(auth_config: AuthConfig) -> Self
pub fn with_insurance(auth_config: AuthConfig) -> Self
Create a new AppState with the insurance marketplace bootstrapped
(default pool with seed reserves, products, self-insurance provider,
and a licensed MGA provider stub).