Skip to content

Commit 952849c

Browse files
ssddOnTopthesapanautofix-ci[bot]
authored
refact: drop unused traits cleanup (#16)
* fix: update SSE URL to use localhost and adjust server readiness poll timeout * refactor: implement exponential backoff for server readiness polling * refactor: remove DynRunnerProcessManager and clean up unused traits and simplify process manager interfaces * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * refactor: clean up unused traits in process management * [autofix.ci] apply automated fixes --------- Co-authored-by: sapan <sapanshah2468@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent e082787 commit 952849c

File tree

5 files changed

+307
-381
lines changed

5 files changed

+307
-381
lines changed

crates/gpmcp-layer-core/src/process.rs

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,32 +67,6 @@ pub enum ProcessError {
6767
Other(String),
6868
}
6969

70-
/// Core trait for process lifecycle management with associated types for better performance
71-
#[async_trait]
72-
pub trait ProcessLifecycle: Send + Sync {
73-
/// The type of process handle this lifecycle manager produces
74-
type Handle: ProcessHandle;
75-
76-
/// Spawn a new process with the given command and arguments
77-
async fn spawn_process(
78-
&self,
79-
command: &str,
80-
args: &[String],
81-
working_dir: Option<&str>,
82-
env: &HashMap<String, String>,
83-
) -> Result<Self::Handle>;
84-
}
85-
86-
/// Trait for comprehensive process termination including process trees
87-
#[async_trait]
88-
pub trait ProcessTermination: Send + Sync {
89-
/// Find all child processes of a given process
90-
async fn find_child_processes(&self, pid: ProcessId) -> Result<Vec<ProcessId>>;
91-
92-
/// Terminate an entire process tree (parent and all descendants)
93-
async fn terminate_process_tree(&self, root_pid: ProcessId) -> TerminationResult;
94-
}
95-
9670
/// Trait representing a handle to a running process
9771
#[async_trait]
9872
pub trait ProcessHandle: Send + Sync {
@@ -108,14 +82,30 @@ pub trait ProcessHandle: Send + Sync {
10882

10983
/// High-level process manager trait that combines lifecycle and termination
11084
#[async_trait]
111-
pub trait ProcessManager: ProcessLifecycle + ProcessTermination {
85+
pub trait ProcessManager {
86+
/// The type of process handle this lifecycle manager produces
87+
type Handle: ProcessHandle;
11288
/// Create a new process manager instance
11389
fn new() -> Self
11490
where
11591
Self: Sized;
11692

11793
/// Cleanup any resources held by the process manager
11894
async fn cleanup(&self) -> Result<()>;
95+
/// Find all child processes of a given process
96+
async fn find_child_processes(&self, pid: ProcessId) -> Result<Vec<ProcessId>>;
97+
98+
/// Terminate an entire process tree (parent and all descendants)
99+
async fn terminate_process_tree(&self, root_pid: ProcessId) -> TerminationResult;
100+
101+
/// Spawn a new process with the given command and arguments
102+
async fn spawn_process(
103+
&self,
104+
command: &str,
105+
args: &[String],
106+
working_dir: Option<&str>,
107+
env: &HashMap<String, String>,
108+
) -> Result<Self::Handle>;
119109
}
120110

121111
/// Factory trait for creating platform-specific process managers

crates/gpmcp-layer-unix/src/runner_process_manager.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ use crate::unix_process_manager::UnixProcessManager;
33
use anyhow::{Context, Result};
44
use async_trait::async_trait;
55
use gpmcp_layer_core::config::RunnerConfig;
6-
use gpmcp_layer_core::process::{
7-
ProcessHandle, ProcessId, ProcessLifecycle, ProcessManager, ProcessTermination,
8-
TerminationResult,
9-
};
6+
use gpmcp_layer_core::process::{ProcessHandle, ProcessId, ProcessManager, TerminationResult};
107
use gpmcp_layer_core::process_manager_trait::{RunnerProcessManager, RunnerProcessManagerFactory};
118
use std::collections::HashMap;
129
use std::sync::{Arc, Mutex};
@@ -148,10 +145,3 @@ impl RunnerProcessManagerFactory for UnixRunnerProcessManagerFactory {
148145
UnixRunnerProcessManager::new(config)
149146
}
150147
}
151-
152-
#[cfg(test)]
153-
mod tests {
154-
155-
// Note: Tests will be added in a future task as requested by the user
156-
// This module is here to show the structure for when tests are implemented
157-
}

0 commit comments

Comments
 (0)