Controller

Trait Controller 

Source
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§

Source

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.

Source

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.

Source

fn get_runtime_status(&self) -> BlockControllerRuntimeStatus

Get the current runtime status.

Source

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).

Source

fn controller_type(&self) -> &str

Get the controller type (e.g., “shell”, “cmd”).

Source

fn block_id(&self) -> &str

Get the block ID.

Source

fn as_any(&self) -> &dyn Any

Downcast support for concrete controller types.

Implementors§