pub trait Controller: Send + Sync {
// Required methods
fn start(
&self,
block_meta: HashMap<String, Value>,
rt_opts: Option<Value>,
force: bool,
) -> Result<(), String>;
fn stop(&self, graceful: bool, new_status: &str) -> Result<(), String>;
fn get_runtime_status(&self) -> BlockControllerRuntimeStatus;
fn send_input(
&self,
input: BlockInputUnion,
seq: Option<u64>,
) -> Result<(), String>;
fn controller_type(&self) -> &str;
fn block_id(&self) -> &str;
fn as_any(&self) -> &dyn Any;
}Expand description
Trait for block controllers. Each block type has its own implementation.
Port of Go’s blockcontroller.Controller interface.
Required Methods§
Sourcefn start(
&self,
block_meta: HashMap<String, Value>,
rt_opts: Option<Value>,
force: bool,
) -> Result<(), String>
fn start( &self, block_meta: HashMap<String, Value>, rt_opts: Option<Value>, force: bool, ) -> Result<(), String>
Start the controller. May spawn background tasks.
force restarts even if already running.
Sourcefn stop(&self, graceful: bool, new_status: &str) -> Result<(), String>
fn stop(&self, graceful: bool, new_status: &str) -> Result<(), String>
Stop the controller.
graceful waits for process to exit; new_status is the target state.
Sourcefn get_runtime_status(&self) -> BlockControllerRuntimeStatus
fn get_runtime_status(&self) -> BlockControllerRuntimeStatus
Get the current runtime status.
Sourcefn send_input(
&self,
input: BlockInputUnion,
seq: Option<u64>,
) -> Result<(), String>
fn send_input( &self, input: BlockInputUnion, seq: Option<u64>, ) -> Result<(), String>
Send input (terminal data, signal, or resize) to the controller.
seq is the per-TermViewModel monotonic counter; None means fire-and-forget (no ordering).
Sourcefn controller_type(&self) -> &str
fn controller_type(&self) -> &str
Get the controller type (e.g., “shell”, “cmd”).