betex 0.7.7

Betfair / Prediction Market Exchange
Documentation
/// Default capacity for the engine command channel.
pub const DEFAULT_ENGINE_CHANNEL_CAPACITY: usize = 8192;

/// Default batch size for SetMarketState close operations.
pub const DEFAULT_SET_MARKET_STATE_BATCH: u16 = 4096;

/// Default poll timeout for the engine loop in milliseconds.
pub const DEFAULT_ENGINE_POLL_TIMEOUT_MS: u64 = 100;

#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
pub struct ThreadPinning {
    /// Pin the engine command-processing + publishing thread to this core id.
    #[serde(default)]
    pub engine_core: Option<usize>,
    /// Pin the WAL poller thread to this core id.
    #[serde(default)]
    pub wal_poller_core: Option<usize>,
    /// Pin disruptor consumer threads in registration order.
    ///
    /// This applies to handlers registered via `EngineBuilder::{register_handler,...}` only.
    #[serde(default)]
    pub handler_cores: Vec<usize>,
}

#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Config {
    pub ring_size_pow2: usize,
    pub response_timeout_ms: u64,
    /// Initial capacity for per-market order storage.
    ///
    /// This is used to pre-size the book's internal order arena to reduce reallocations
    /// during warm-up and in-play bursts.
    pub order_store_capacity: usize,
    /// If set, enforce that all BinaryYes markets use this denominator (ticks per $1.00 payout).
    ///
    /// Example: `Some(100)` enforces $0.01 per tick.
    #[serde(default)]
    pub enforce_binary_yes_max_price_ticks: Option<u16>,
    #[serde(default)]
    pub pinning: Option<ThreadPinning>,
}

impl Default for Config {
    fn default() -> Self {
        Self {
            ring_size_pow2: 1024,
            response_timeout_ms: 1000,
            order_store_capacity: 20_000,
            enforce_binary_yes_max_price_ticks: None,
            pinning: None,
        }
    }
}