pub struct Escalator { /* private fields */ }Expand description
Periodic task that escalates approval gates past their deadline.
§Examples
use std::sync::Arc;
use std::time::Duration;
use ironflow_api::escalator::Escalator;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_engine::engine::Engine;
use ironflow_store::memory::InMemoryStore;
use ironflow_store::store::Store;
use tokio_util::sync::CancellationToken;
let store: Arc<dyn Store> = Arc::new(InMemoryStore::new());
let engine = Arc::new(Engine::new(store, Arc::new(ClaudeCodeProvider::new())));
let escalator = Escalator::new(engine).interval(Duration::from_secs(15));
tokio::spawn(escalator.run(CancellationToken::new()));Implementations§
Source§impl Escalator
impl Escalator
Sourcepub fn new(engine: Arc<Engine>) -> Self
pub fn new(engine: Arc<Engine>) -> Self
Create an escalator with the default interval and batch size.
Sourcepub fn interval(self, interval: Duration) -> Self
pub fn interval(self, interval: Duration) -> Self
Set how often expired deadlines are collected.
Keep it well below the shortest SLA in use, otherwise a gate overshoots its deadline by up to one interval.
Sourcepub fn batch_size(self, batch_size: u32) -> Self
pub fn batch_size(self, batch_size: u32) -> Self
Set how many gates a single tick resolves.
Sourcepub async fn run(self, shutdown: CancellationToken)
pub async fn run(self, shutdown: CancellationToken)
Run the escalation loop until shutdown is cancelled.
Store errors are logged and the loop keeps going: a transient database failure must not silently stop escalation.
Auto Trait Implementations§
impl !RefUnwindSafe for Escalator
impl !UnwindSafe for Escalator
impl Freeze for Escalator
impl Send for Escalator
impl Sync for Escalator
impl Unpin for Escalator
impl UnsafeUnpin for Escalator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more