pub struct ActionContext {
pub task_id: TaskId,
pub step_id: StepId,
pub execution_id: String,
pub working_set: Arc<RwLock<WorkingSet>>,
pub cancellation_token: CancellationToken,
}Expand description
Execution context for actions
Provides access to:
- Task and step identification
- WorkingSet for inter-step communication
- CancellationToken for cooperative cancellation
Fields§
§task_id: TaskIdTask ID
step_id: StepIdStep ID (logical ID)
execution_id: StringExecution ID (runtime ID for this specific execution) Distinguishes retry/resume runs of the same step
working_set: Arc<RwLock<WorkingSet>>Working set for inter-step communication
cancellation_token: CancellationTokenCancellation token for cooperative cancellation Actions should check this periodically and abort if cancelled
Implementations§
Source§impl ActionContext
impl ActionContext
Sourcepub fn new(
task_id: impl Into<TaskId>,
step_id: impl Into<StepId>,
execution_id: impl Into<String>,
working_set: Arc<RwLock<WorkingSet>>,
) -> ActionContext
pub fn new( task_id: impl Into<TaskId>, step_id: impl Into<StepId>, execution_id: impl Into<String>, working_set: Arc<RwLock<WorkingSet>>, ) -> ActionContext
Create a new action context
Sourcepub fn with_cancellation_token(
task_id: impl Into<TaskId>,
step_id: impl Into<StepId>,
execution_id: impl Into<String>,
working_set: Arc<RwLock<WorkingSet>>,
cancellation_token: CancellationToken,
) -> ActionContext
pub fn with_cancellation_token( task_id: impl Into<TaskId>, step_id: impl Into<StepId>, execution_id: impl Into<String>, working_set: Arc<RwLock<WorkingSet>>, cancellation_token: CancellationToken, ) -> ActionContext
Create a new action context with a specific cancellation token
Sourcepub fn new_execution_id() -> String
pub fn new_execution_id() -> String
Generate a new execution ID
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Check if the action has been cancelled
Sourcepub fn child_token(&self) -> CancellationToken
pub fn child_token(&self) -> CancellationToken
Create a child cancellation token The child will be cancelled when the parent is cancelled
Trait Implementations§
Source§impl Clone for ActionContext
impl Clone for ActionContext
Source§fn clone(&self) -> ActionContext
fn clone(&self) -> ActionContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ActionContext
impl !UnwindSafe for ActionContext
impl Freeze for ActionContext
impl Send for ActionContext
impl Sync for ActionContext
impl Unpin for ActionContext
impl UnsafeUnpin for ActionContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more