Expand description
Execution context for tasks running inside a rustvello runner.
Provides tokio::task_local! context so that a running task can discover
its own invocation identity, workflow membership, and the runner that
is executing it. This mirrors pynenc’s context.py module.
§Usage
The [TaskRunner] sets both contexts before executing a task:
ⓘ
use rustvello_core::context::*;
INVOCATION_CTX.scope(inv_ctx, RUNNER_CTX.scope(run_ctx, async {
// inside here, get_invocation_context() returns Some(...)
let ctx = get_invocation_context().unwrap();
})).await;When a task calls app.call() inside its body, the app layer reads
the current InvocationContext to determine parent/workflow inheritance.
Structs§
- Invocation
Context - Context for the currently executing invocation.
- Runner
Context - Context identifying the runner that is executing the current task.
Statics§
- INVOCATION_
CTX - The invocation context for the currently running task.
- RUNNER_
CTX - The runner context for the current execution environment.
Functions§
- clear_
thread_ invocation_ context - Clear the thread-local invocation context.
- clear_
thread_ runner_ context - Clear the thread-local runner context.
- get_
invocation_ context - Get the current invocation context, if running inside a task.
- get_
or_ create_ runner_ context - Get the full runner context for the current execution.
- get_
or_ create_ runner_ id - Get the runner ID for the current execution context.
- get_
runner_ context - Get the current runner context, if set.
- set_
thread_ invocation_ context - Set the thread-local invocation context (for use before
spawn_blocking). - set_
thread_ runner_ context - Set the thread-local runner context (for use before
spawn_blocking). - with_
invocation_ context - Access the current invocation context by reference, avoiding a clone when the tokio task-local is available.
- with_
runner_ context - Access the current runner context by reference, avoiding a clone.