pub struct Engine {
pub config: EngineConfig,
pub metrics: Metrics,
pub changed: Arc<Notify>,
/* private fields */
}Fields§
§config: EngineConfig§metrics: Metrics§changed: Arc<Notify>Implementations§
Source§impl Engine
impl Engine
Sourcepub fn open(store: Store, config: EngineConfig, clock: Clock) -> Result<Engine>
pub fn open(store: Store, config: EngineConfig, clock: Clock) -> Result<Engine>
Open the engine and recover every non-terminal execution from history.
pub fn now(&self) -> u64
pub fn register_definition(&mut self, ir: WorkflowIr) -> Result<bool>
pub fn definitions(&self) -> Vec<Arc<WorkflowIr>>
pub fn definition( &self, name: &str, version: Option<&str>, ) -> Option<Arc<WorkflowIr>>
pub fn start( &mut self, workflow: &str, version: Option<&str>, input: Value, execution_id: Option<String>, ) -> Result<StartResult>
pub fn cancel(&mut self, id: &str, reason: &str) -> Result<ExecutionState>
Sourcepub fn signal(&mut self, id: &str, name: &str, payload: Value) -> Result<u64>
pub fn signal(&mut self, id: &str, name: &str, payload: Value) -> Result<u64>
Send a typed signal to a running execution. The payload is validated
against the workflow’s signal declaration (defaults applied) and
buffered until an await step takes it. Returns the history sequence
number of the recorded signal.
Sourcepub fn query(&self, id: &str, name: &str) -> Result<Value>
pub fn query(&self, id: &str, name: &str) -> Result<Value>
Evaluate a declared query against the current state of an execution.
Steps that have not completed read as null.
pub fn execution(&self, id: &str) -> Result<ExecutionState>
pub fn history(&self, id: &str) -> Result<Vec<HistoryEvent>>
pub fn list_executions( &self, status: Option<&str>, workflow: Option<&str>, limit: u32, ) -> Result<Vec<ExecutionSummary>>
pub fn active_count(&self) -> usize
Sourcepub fn tick(&mut self) -> Result<Vec<TaskAssignment>>
pub fn tick(&mut self) -> Result<Vec<TaskAssignment>>
Periodic work: timers, retries, deadlines, worker liveness, built-ins.
pub fn register_worker(&mut self, req: RegisterWorker) -> Result<Registration>
pub fn heartbeat(&mut self, session_id: &str) -> Result<HeartbeatAck>
pub fn unregister_worker(&mut self, session_id: &str) -> Result<()>
pub fn workers(&self) -> Result<Vec<WorkerInfo>>
Sourcepub fn poll(&mut self, session_id: &str) -> Result<Option<TaskAssignment>>
pub fn poll(&mut self, session_id: &str) -> Result<Option<TaskAssignment>>
Hand the oldest matching queued task to a worker, if any.
Sourcepub fn complete(&mut self, token: &str, output: Value) -> Result<ResultAck>
pub fn complete(&mut self, token: &str, output: Value) -> Result<ResultAck>
Record a successful task result.
Sourcepub fn fail(&mut self, token: &str, error: TaskError) -> Result<ResultAck>
pub fn fail(&mut self, token: &str, error: TaskError) -> Result<ResultAck>
Record a failed attempt.
pub fn store_stats(&self) -> Result<Vec<(String, u64)>>
Sourcepub fn enable_telemetry(&mut self, config: TelemetryConfig)
pub fn enable_telemetry(&mut self, config: TelemetryConfig)
Export OpenTelemetry traces of executions (see crate::telemetry).
Sourcepub fn session_worker(&self, session_id: &str) -> Option<&str>
pub fn session_worker(&self, session_id: &str) -> Option<&str>
The worker id that owns a session, if the session exists.
Sourcepub fn token_worker(&self, token: &str) -> Option<&str>
pub fn token_worker(&self, token: &str) -> Option<&str>
The worker id a task token was issued to, if the token is known.
pub fn session_count(&self) -> usize
Sourcepub fn refresh_definitions(&mut self) -> Result<usize>
pub fn refresh_definitions(&mut self) -> Result<usize>
Load definitions registered in the store since this engine opened (another server registered them). Used by cluster standbys, whose engine only reads. Returns how many were new.
Auto Trait Implementations§
impl !Freeze for Engine
impl !RefUnwindSafe for Engine
impl !Sync for Engine
impl !UnwindSafe for Engine
impl Forget for Engine
impl Move for Engine
impl Send for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request