#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StartPosition {
FromBeginning,
LiveOnly,
FromSeq(u64),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FoldErrorPolicy {
Stop,
LogAndContinue,
}
pub const RYW_INFLIGHT_CAP_DEFAULT: usize = 1024;
#[derive(Debug, Clone, Copy)]
pub struct CortexAdapterConfig {
pub start: StartPosition,
pub on_fold_error: FoldErrorPolicy,
pub ryw_inflight_cap: usize,
}
impl Default for CortexAdapterConfig {
fn default() -> Self {
Self {
start: StartPosition::FromBeginning,
on_fold_error: FoldErrorPolicy::Stop,
ryw_inflight_cap: RYW_INFLIGHT_CAP_DEFAULT,
}
}
}
impl CortexAdapterConfig {
pub fn new() -> Self {
Self::default()
}
pub fn with_start(mut self, start: StartPosition) -> Self {
self.start = start;
self
}
pub fn with_fold_error_policy(mut self, policy: FoldErrorPolicy) -> Self {
self.on_fold_error = policy;
self
}
pub fn with_ryw_inflight_cap(mut self, cap: usize) -> Self {
self.ryw_inflight_cap = cap;
self
}
}