pub struct BootstrappedEngine<H: ExecutorHandler + 'static, C: Clock = SystemClock> { /* private fields */ }Expand description
A bootstrapped engine ready for task submission and execution.
Implementations§
Source§impl<H: ExecutorHandler + 'static, C: Clock> BootstrappedEngine<H, C>
impl<H: ExecutorHandler + 'static, C: Clock> BootstrappedEngine<H, C>
Sourcepub fn submit_task(&mut self, spec: TaskSpec) -> Result<(), EngineError>
pub fn submit_task(&mut self, spec: TaskSpec) -> Result<(), EngineError>
Submits a new task specification for execution.
Sourcepub async fn tick(&mut self) -> Result<TickResult, EngineError>
pub async fn tick(&mut self) -> Result<TickResult, EngineError>
Advances the dispatch loop by one tick.
Sourcepub async fn run_until_idle(&mut self) -> Result<RunSummary, EngineError>
pub async fn run_until_idle(&mut self) -> Result<RunSummary, EngineError>
Runs the dispatch loop until no work remains.
Sourcepub fn projection(&self) -> &ReplayReducer
pub fn projection(&self) -> &ReplayReducer
Returns a reference to the current projection state.
Sourcepub fn declare_dependency(
&mut self,
task_id: TaskId,
prereqs: Vec<TaskId>,
) -> Result<(), EngineError>
pub fn declare_dependency( &mut self, task_id: TaskId, prereqs: Vec<TaskId>, ) -> Result<(), EngineError>
Declares a DAG dependency.
Sourcepub async fn drain_and_shutdown(
self,
timeout: Duration,
) -> Result<(), EngineError>
pub async fn drain_and_shutdown( self, timeout: Duration, ) -> Result<(), EngineError>
Gracefully drains in-flight work and then shuts down.
Stops promoting and dispatching new work, but continues processing in-flight results and heartbeating leases until all in-flight work completes or the timeout expires. The WAL writer is flushed and closed on drop of the underlying authority.
Sourcepub fn shutdown(self) -> Result<(), EngineError>
pub fn shutdown(self) -> Result<(), EngineError>
Shuts down the engine immediately, consuming it.
In-flight workers will continue to completion in their tokio blocking tasks. Worker results for in-flight runs are lost; those runs will recover via lease expiry on the next bootstrap. The WAL writer is flushed and closed on drop of the underlying authority.
For orderly drain of in-flight work, use drain_and_shutdown() instead.