use std::time::Duration;
pub const DEFAULT_CACHE_EVENT_COUNT: u32 = 100;
pub const DEFAULT_PREFETCH_COUNT: u32 = 300;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ReadEventOptions {
pub maximum_wait_time: Option<Duration>,
pub cache_event_count: u32,
pub prefetch_count: u32,
pub owner_level: Option<i64>,
pub track_last_enqueued_event_properties: bool,
}
impl Default for ReadEventOptions {
fn default() -> Self {
Self {
maximum_wait_time: None,
cache_event_count: DEFAULT_CACHE_EVENT_COUNT,
prefetch_count: DEFAULT_PREFETCH_COUNT,
owner_level: None,
track_last_enqueued_event_properties: true,
}
}
}
impl ReadEventOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_maximum_wait_time(mut self, maximum_wait_time: Duration) -> Self {
self.maximum_wait_time = Some(maximum_wait_time);
self
}
pub fn with_cache_event_count(mut self, cache_event_count: u32) -> Self {
self.cache_event_count = cache_event_count;
self
}
pub fn with_prefetch_count(mut self, prefetch_count: u32) -> Self {
self.prefetch_count = prefetch_count;
self
}
pub fn with_owner_level(mut self, owner_level: i64) -> Self {
self.owner_level = Some(owner_level);
self
}
pub fn with_track_last_enqueued_event_properties(
mut self,
track_last_enqueued_event_properties: bool,
) -> Self {
self.track_last_enqueued_event_properties = track_last_enqueued_event_properties;
self
}
}