pub struct BackgroundProcessManager { /* private fields */ }Expand description
Manages background processes like port-forwards.
Thread-safe and designed to be shared across the agent session.
Implementations§
Source§impl BackgroundProcessManager
impl BackgroundProcessManager
Sourcepub async fn start_port_forward(
&self,
id: &str,
resource: &str,
namespace: &str,
target_port: u16,
) -> Result<u16, BackgroundProcessError>
pub async fn start_port_forward( &self, id: &str, resource: &str, namespace: &str, target_port: u16, ) -> Result<u16, BackgroundProcessError>
Start a kubectl port-forward in the background.
Returns the local port that was allocated.
§Arguments
id- Unique identifier for this port-forwardresource- Kubernetes resource (e.g., “svc/prometheus-server” or “pod/prometheus-0”)namespace- Kubernetes namespacetarget_port- The port on the remote resource
§Example
ⓘ
let port = manager.start_port_forward(
"prometheus",
"svc/prometheus-server",
"monitoring",
9090
).await?;Sourcepub async fn start(
&self,
id: &str,
command: &str,
working_dir: &Path,
) -> Result<(), BackgroundProcessError>
pub async fn start( &self, id: &str, command: &str, working_dir: &Path, ) -> Result<(), BackgroundProcessError>
Start a generic background command.
§Arguments
id- Unique identifier for this processcommand- The command to executeworking_dir- Working directory for the command
Sourcepub async fn stop(&self, id: &str) -> Result<(), BackgroundProcessError>
pub async fn stop(&self, id: &str) -> Result<(), BackgroundProcessError>
Stop a background process by ID.
Sourcepub async fn is_running(&self, id: &str) -> bool
pub async fn is_running(&self, id: &str) -> bool
Check if a process is running.
Sourcepub async fn get(&self, id: &str) -> Option<ProcessInfo>
pub async fn get(&self, id: &str) -> Option<ProcessInfo>
Get information about a specific process.
Sourcepub async fn list(&self) -> Vec<ProcessInfo>
pub async fn list(&self) -> Vec<ProcessInfo>
List all background processes.
Trait Implementations§
Source§impl Default for BackgroundProcessManager
impl Default for BackgroundProcessManager
Auto Trait Implementations§
impl Freeze for BackgroundProcessManager
impl !RefUnwindSafe for BackgroundProcessManager
impl Send for BackgroundProcessManager
impl Sync for BackgroundProcessManager
impl Unpin for BackgroundProcessManager
impl !UnwindSafe for BackgroundProcessManager
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
Mutably borrows from an owned value. Read more
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> 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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.