pub trait TaskHost: Send + Sync {
// Required methods
fn caller_task_id(&self, lane: &str) -> Option<String>;
fn task_lane(&self, task_id: &str) -> Option<String>;
fn strategy(&self, definition: &str) -> Result<String, String>;
fn tasks(&self) -> Result<Vec<Value>, String>;
fn spawn(
&self,
request: &Value,
parent: Option<&str>,
) -> Result<Value, String>;
fn result(&self, task_id: &str) -> Result<Value, String>;
fn cancel(&self, task_id: &str, reason: &str) -> Result<Value, String>;
fn steer(&self, task_id: &str, message: &str) -> Result<bool, String>;
fn now(&self) -> i64;
// Provided methods
fn usage(&self) -> Result<Option<Value>, String> { ... }
fn pin_lane(&self, _lane: &str, _holder: &str) -> bool { ... }
fn unpin_lane(&self, _lane: &str, _holder: &str) { ... }
}Required Methods§
Sourcefn caller_task_id(&self, lane: &str) -> Option<String>
fn caller_task_id(&self, lane: &str) -> Option<String>
Task that owns lane, or None for the root lane.
Sourcefn strategy(&self, definition: &str) -> Result<String, String>
fn strategy(&self, definition: &str) -> Result<String, String>
Execution strategy of a registered definition (“deterministic” | “predict” | “rlm”).
Sourcefn tasks(&self) -> Result<Vec<Value>, String>
fn tasks(&self) -> Result<Vec<Value>, String>
Every task of the session (NativeTask objects: id, parentId, definition, state, …).
Sourcefn spawn(&self, request: &Value, parent: Option<&str>) -> Result<Value, String>
fn spawn(&self, request: &Value, parent: Option<&str>) -> Result<Value, String>
Admits request ({definition, input, model?, key?, timeoutMs?, lane?}) as a child of parent.
Sourcefn result(&self, task_id: &str) -> Result<Value, String>
fn result(&self, task_id: &str) -> Result<Value, String>
Blocks until the task’s durable terminal result (NativeResult).
fn cancel(&self, task_id: &str, reason: &str) -> Result<Value, String>
Sourcefn steer(&self, task_id: &str, message: &str) -> Result<bool, String>
fn steer(&self, task_id: &str, message: &str) -> Result<bool, String>
Queues a steering message into a running task’s lane; false when it has no live lane.
fn now(&self) -> i64
Provided Methods§
Sourcefn pin_lane(&self, _lane: &str, _holder: &str) -> bool
fn pin_lane(&self, _lane: &str, _holder: &str) -> bool
Keeps a lane’s Python kernel alive for holder; false when the host has no pool or no pin capacity left.
fn unpin_lane(&self, _lane: &str, _holder: &str)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".