pub struct RuntimeContext {
pub execution_id: String,
pub graph_id: String,
pub current_node: Arc<RwLock<String>>,
pub remaining_steps: RemainingSteps,
pub config: GraphConfig,
pub metadata: HashMap<String, Value>,
pub parent_execution_id: Option<String>,
pub tags: Vec<String>,
}Expand description
Runtime context passed to node functions
Contains non-state information about the current execution, including execution ID, current node, remaining steps, and metadata.
Fields§
§execution_id: StringUnique execution ID
graph_id: StringGraph ID
current_node: Arc<RwLock<String>>Current node ID (updated during execution)
remaining_steps: RemainingStepsRemaining steps tracker
config: GraphConfigGraph configuration
metadata: HashMap<String, Value>Execution metadata
parent_execution_id: Option<String>Parent execution ID (for sub-workflows)
Execution tags
Implementations§
Source§impl RuntimeContext
impl RuntimeContext
Sourcepub fn new(graph_id: impl Into<String>) -> RuntimeContext
pub fn new(graph_id: impl Into<String>) -> RuntimeContext
Create a new runtime context
Sourcepub fn with_config(
graph_id: impl Into<String>,
config: GraphConfig,
) -> RuntimeContext
pub fn with_config( graph_id: impl Into<String>, config: GraphConfig, ) -> RuntimeContext
Create a context with a specific config
Sourcepub fn for_sub_workflow(
graph_id: impl Into<String>,
parent_execution_id: impl Into<String>,
config: GraphConfig,
) -> RuntimeContext
pub fn for_sub_workflow( graph_id: impl Into<String>, parent_execution_id: impl Into<String>, config: GraphConfig, ) -> RuntimeContext
Create a context for a sub-workflow
Sourcepub async fn current_node(&self) -> String
pub async fn current_node(&self) -> String
Get the current node ID
Sourcepub async fn set_current_node(&self, node_id: impl Into<String>)
pub async fn set_current_node(&self, node_id: impl Into<String>)
Set the current node ID
Sourcepub async fn is_recursion_limit_reached(&self) -> bool
pub async fn is_recursion_limit_reached(&self) -> bool
Check if recursion limit is reached
Sourcepub async fn decrement_steps(&self) -> u32
pub async fn decrement_steps(&self) -> u32
Decrement remaining steps
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: Value,
) -> RuntimeContext
pub fn with_metadata( self, key: impl Into<String>, value: Value, ) -> RuntimeContext
Add metadata
Sourcepub fn with_tag(self, tag: impl Into<String>) -> RuntimeContext
pub fn with_tag(self, tag: impl Into<String>) -> RuntimeContext
Add a tag
Sourcepub fn is_sub_workflow(&self) -> bool
pub fn is_sub_workflow(&self) -> bool
Check if this is a sub-workflow execution
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuntimeContext
impl !RefUnwindSafe for RuntimeContext
impl Send for RuntimeContext
impl Sync for RuntimeContext
impl Unpin for RuntimeContext
impl UnsafeUnpin for RuntimeContext
impl !UnwindSafe for RuntimeContext
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> 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 moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage