pub enum ExecutionState {
Queued,
Running,
Cancelling,
Succeeded,
Failed,
Cancelled,
}Expand description
Where an execution is in its life.
The transitions are the whole contract, and ExecutionState::may_move_to is the one
place they are written down: the engine asks before every change, the store refuses a
move it did not allow, and a client that reads a final state never sees it move again.
queued ──► running ──┬──► succeeded
│ ├──► failed
│ └──► cancelling ──┬──► cancelled
│ ├──► succeeded
└──► cancelled └──► failedThere is no starting. An in-process engine claims an execution and enters its handler
in the same instant, so a state between the two would be one no client could ever
observe and every client would have to handle.
Variants§
Queued
Accepted, and no worker has picked it up.
Running
The handler is running.
Cancelling
Cancellation was asked for and the handler has not stopped yet.
Succeeded
The handler returned an output.
Failed
The handler returned an error, or the worker could not run it.
Cancelled
It stopped because it was asked to.
Implementations§
Source§impl ExecutionState
impl ExecutionState
Sourcepub fn is_final(self) -> bool
pub fn is_final(self) -> bool
Is this the last thing that will be said about the execution?
use majordomus_cli::execution::ExecutionState;
assert!(ExecutionState::Succeeded.is_final());
assert!(!ExecutionState::Cancelling.is_final());Sourcepub fn may_move_to(self, next: ExecutionState) -> bool
pub fn may_move_to(self, next: ExecutionState) -> bool
May the execution move from here to next?
use majordomus_cli::execution::ExecutionState::*;
assert!(Queued.may_move_to(Running));
assert!(Running.may_move_to(Cancelling));
assert!(Queued.may_move_to(Cancelled), "a queued execution is cancelled without running");
assert!(!Succeeded.may_move_to(Running), "a final state is final");
assert!(!Running.may_move_to(Queued), "nothing goes back");Trait Implementations§
Source§impl Clone for ExecutionState
impl Clone for ExecutionState
Source§fn clone(&self) -> ExecutionState
fn clone(&self) -> ExecutionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ExecutionState
Source§impl Debug for ExecutionState
impl Debug for ExecutionState
Source§impl<'de> Deserialize<'de> for ExecutionState
impl<'de> Deserialize<'de> for ExecutionState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ExecutionState
Source§impl Hash for ExecutionState
impl Hash for ExecutionState
Source§impl JsonSchema for ExecutionState
impl JsonSchema for ExecutionState
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for ExecutionState
impl Ord for ExecutionState
Source§fn cmp(&self, other: &ExecutionState) -> Ordering
fn cmp(&self, other: &ExecutionState) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ExecutionState
impl PartialEq for ExecutionState
Source§fn eq(&self, other: &ExecutionState) -> bool
fn eq(&self, other: &ExecutionState) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ExecutionState
impl PartialOrd for ExecutionState
Source§impl Serialize for ExecutionState
impl Serialize for ExecutionState
impl StructuralPartialEq for ExecutionState
Auto Trait Implementations§
impl Freeze for ExecutionState
impl RefUnwindSafe for ExecutionState
impl Send for ExecutionState
impl Sync for ExecutionState
impl Unpin for ExecutionState
impl UnsafeUnpin for ExecutionState
impl UnwindSafe for ExecutionState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.