ProcessRunner

Trait ProcessRunner 

Source
pub trait ProcessRunner: Send + Sync {
    // Required methods
    fn start<'life0, 'async_trait>(
        &'life0 self,
        config: ServerConfig,
    ) -> Pin<Box<dyn Future<Output = Result<ProcessHandle, ProcessError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'life1, 'async_trait>(
        &'life0 self,
        handle: &'life1 ProcessHandle,
    ) -> Pin<Box<dyn Future<Output = Result<(), ProcessError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_running<'life0, 'life1, 'async_trait>(
        &'life0 self,
        handle: &'life1 ProcessHandle,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn health<'life0, 'life1, 'async_trait>(
        &'life0 self,
        handle: &'life1 ProcessHandle,
    ) -> Pin<Box<dyn Future<Output = Result<ServerHealth, ProcessError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_running<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ProcessHandle>, ProcessError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Process runner for managing model server processes.

This trait abstracts process management for testability and potential alternative backends (local, remote, containerized).

§Design Rules

  • Express intent, not implementation detail
  • No CLI/Tauri/Axum concerns in signatures
  • Must support: mock runner, remote runner, alternative inference backends

Required Methods§

Source

fn start<'life0, 'async_trait>( &'life0 self, config: ServerConfig, ) -> Pin<Box<dyn Future<Output = Result<ProcessHandle, ProcessError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start a model server with the given configuration.

Returns a handle that can be used to manage the process.

Source

fn stop<'life0, 'life1, 'async_trait>( &'life0 self, handle: &'life1 ProcessHandle, ) -> Pin<Box<dyn Future<Output = Result<(), ProcessError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stop a running server.

Returns Err(ProcessError::NotRunning) if the process isn’t running.

Source

fn is_running<'life0, 'life1, 'async_trait>( &'life0 self, handle: &'life1 ProcessHandle, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a server is still running.

Source

fn health<'life0, 'life1, 'async_trait>( &'life0 self, handle: &'life1 ProcessHandle, ) -> Pin<Box<dyn Future<Output = Result<ServerHealth, ProcessError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the health status of a running server.

Returns Err(ProcessError::NotRunning) if the process isn’t running.

Source

fn list_running<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ProcessHandle>, ProcessError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all currently running server processes.

This is needed for snapshot behavior (e.g., server:snapshot events).

Implementors§