pub struct ProcessService { /* private fields */ }Implementations§
Source§impl ProcessService
impl ProcessService
Source§impl ProcessService
impl ProcessService
Sourcepub fn get_status(&mut self) -> HashMap<String, String>
pub fn get_status(&mut self) -> HashMap<String, String>
Get status of all processes
Returns a HashMap mapping process names to status strings
Sourcepub fn stop(&mut self, name: &str) -> Result<()>
pub fn stop(&mut self, name: &str) -> Result<()>
Stop a specific process by name. Returns an error if the process is not found. Uses a
default 10-second timeout for graceful shutdown; use stop_with_timeout for a custom one.
Sourcepub fn stop_with_timeout(&mut self, name: &str, timeout: Duration) -> Result<()>
pub fn stop_with_timeout(&mut self, name: &str, timeout: Duration) -> Result<()>
Stop a process with timeout for graceful shutdown. Tries graceful shutdown (SIGTERM on Unix), then force kills after the timeout.
pub fn force_kill(&mut self, name: &str) -> Result<()>
Sourcepub fn cleanup(&mut self)
pub fn cleanup(&mut self)
Stop all processes gracefully in dependency order, delegating to the runtime’s ProcessManager.
pub fn is_running(&mut self, name: &str) -> bool
Source§impl ProcessService
impl ProcessService
Sourcepub fn find_global_binary(node_name: &str) -> Option<PathBuf>
pub fn find_global_binary(node_name: &str) -> Option<PathBuf>
Find globally installed binary for a node. Searches ~/.cargo/bin/{node_name} then
~/.mecha10/bin/{node_name}.
Sourcepub fn resolve_node_runner_path() -> String
pub fn resolve_node_runner_path() -> String
Resolve path to mecha10-node-runner binary: global installation at
~/.cargo/bin/mecha10-node-runner, else falls back to relying on PATH.
Sourcepub fn is_node_runner_available() -> bool
pub fn is_node_runner_available() -> bool
Check if mecha10-node-runner is available
Source§impl ProcessService
impl ProcessService
Sourcepub fn spawn_node(
&mut self,
name: &str,
binary_path: &str,
args: &[&str],
) -> Result<u32>
pub fn spawn_node( &mut self, name: &str, binary_path: &str, args: &[&str], ) -> Result<u32>
Spawn a node process, tracked under name. Returns an error if the process cannot be
spawned.
Sourcepub fn spawn_with_output(
&mut self,
name: &str,
binary_path: &str,
args: &[&str],
) -> Result<u32>
pub fn spawn_with_output( &mut self, name: &str, binary_path: &str, args: &[&str], ) -> Result<u32>
Spawn a process with output capture, tracked under name.
Sourcepub fn spawn_with_env(
&mut self,
name: &str,
binary_path: &str,
args: &[&str],
env: HashMap<String, String>,
) -> Result<u32>
pub fn spawn_with_env( &mut self, name: &str, binary_path: &str, args: &[&str], env: HashMap<String, String>, ) -> Result<u32>
Spawn a process with custom environment variables, tracked under name.
Source§impl ProcessService
impl ProcessService
Sourcepub fn spawn_node_runner(
&mut self,
node_identifier: &str,
project_name: &str,
project_env: Option<HashMap<String, String>>,
) -> Result<u32>
pub fn spawn_node_runner( &mut self, node_identifier: &str, project_name: &str, project_env: Option<HashMap<String, String>>, ) -> Result<u32>
Spawn a node using mecha10-node-runner, which handles binary resolution, model pulling, and env setup. Returns the process ID of the spawned node-runner instance, or an error if it cannot be spawned.
Sourcepub fn spawn_node_direct(
&mut self,
node_identifier: &str,
_project_name: &str,
project_env: Option<HashMap<String, String>>,
) -> Result<u32>
pub fn spawn_node_direct( &mut self, node_identifier: &str, _project_name: &str, project_env: Option<HashMap<String, String>>, ) -> Result<u32>
Spawn a node directly (standalone mode)
This is used when mecha10-node-runner is not available. Handles both framework nodes (via BinaryManager) and local project nodes (built and run directly).
Source§impl ProcessService
impl ProcessService
Sourcepub fn track_dependency(&mut self, node: &str, dependencies: Vec<String>)
pub fn track_dependency(&mut self, node: &str, dependencies: Vec<String>)
Track dependency relationship for a node. dependencies is the list of nodes node
depends on.
Sourcepub fn get_shutdown_order(&self) -> Vec<String>
pub fn get_shutdown_order(&self) -> Vec<String>
Get shutdown order (reverse dependency order): nodes with dependents first, then their dependencies, so we never stop a node while others still depend on it.
Sourcepub fn manager(&mut self) -> &mut ProcessManager
pub fn manager(&mut self) -> &mut ProcessManager
Get access to the underlying ProcessManager, for advanced operations.
Trait Implementations§
Source§impl Default for ProcessService
impl Default for ProcessService
Source§impl Drop for ProcessService
impl Drop for ProcessService
Auto Trait Implementations§
impl !RefUnwindSafe for ProcessService
impl !UnwindSafe for ProcessService
impl Freeze for ProcessService
impl Send for ProcessService
impl Sync for ProcessService
impl Unpin for ProcessService
impl UnsafeUnpin for ProcessService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more