2024-03-18 12:30:31 +00:00
|
|
|
use std::time::Duration;
|
|
|
|
|
2024-03-01 17:12:53 +00:00
|
|
|
/// Configuration for the engine behaviour
|
2024-03-20 17:11:55 +00:00
|
|
|
///
|
2024-03-01 17:12:53 +00:00
|
|
|
/// The defaults are optimal so please only modify these if you know deliberately why you are modifying them.
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
2024-03-15 11:36:31 +00:00
|
|
|
#[doc(hidden)]
|
2024-04-02 20:12:08 +00:00
|
|
|
#[non_exhaustive]
|
2024-03-01 17:12:53 +00:00
|
|
|
pub struct EngineOptions {
|
|
|
|
/// The maximum number of live queries that can be created in a single transaction
|
|
|
|
pub new_live_queries_per_transaction: u32,
|
|
|
|
/// The size of batches being requested per update in order to catch up a live query
|
|
|
|
pub live_query_catchup_size: u32,
|
2024-03-18 12:30:31 +00:00
|
|
|
pub tick_interval: Duration,
|
2024-03-01 17:12:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for EngineOptions {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
new_live_queries_per_transaction: 100,
|
|
|
|
live_query_catchup_size: 1000,
|
2024-05-09 13:03:33 +00:00
|
|
|
tick_interval: Duration::from_secs(10),
|
2024-03-01 17:12:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-14 09:41:01 +00:00
|
|
|
|
|
|
|
impl EngineOptions {
|
|
|
|
pub fn with_tick_interval(mut self, tick_interval: Duration) -> Self {
|
|
|
|
self.tick_interval = tick_interval;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|