pub struct ProcessRegistry { /* private fields */ }Expand description
Thread-safe in-memory store of tracked processes.
Intended to be wrapped in Arc<tokio::sync::RwLock<ProcessRegistry>> and
shared between the sandbox backend (writes) and LLM tools (reads).
Implementations§
Source§impl ProcessRegistry
impl ProcessRegistry
Sourcepub fn insert(&mut self, record: ProcessRecord) -> Result<(), SandboxError>
pub fn insert(&mut self, record: ProcessRecord) -> Result<(), SandboxError>
Register a newly-spawned process.
Returns SandboxError::RegistryFull if max_tracked would be exceeded.
Sourcepub fn get(&self, pid: u32) -> Option<&ProcessRecord>
pub fn get(&self, pid: u32) -> Option<&ProcessRecord>
Look up a process by PID.
Sourcepub fn get_mut(&mut self, pid: u32) -> Option<&mut ProcessRecord>
pub fn get_mut(&mut self, pid: u32) -> Option<&mut ProcessRecord>
Mutably look up a process by PID.
Sourcepub fn running(&self) -> impl Iterator<Item = &ProcessRecord>
pub fn running(&self) -> impl Iterator<Item = &ProcessRecord>
Return all currently-running processes.
Sourcepub fn all(&self) -> impl Iterator<Item = &ProcessRecord>
pub fn all(&self) -> impl Iterator<Item = &ProcessRecord>
Return all processes (running and exited).
Sourcepub fn mark_exited(&mut self, pid: u32, code: i32)
pub fn mark_exited(&mut self, pid: u32, code: i32)
Mark a process as exited.
Sourcepub fn mark_signaled(&mut self, pid: u32, signal: i32)
pub fn mark_signaled(&mut self, pid: u32, signal: i32)
Mark a process as signaled.
Trait Implementations§
Source§impl Debug for ProcessRegistry
impl Debug for ProcessRegistry
Source§impl Default for ProcessRegistry
impl Default for ProcessRegistry
Source§fn default() -> ProcessRegistry
fn default() -> ProcessRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProcessRegistry
impl RefUnwindSafe for ProcessRegistry
impl Send for ProcessRegistry
impl Sync for ProcessRegistry
impl Unpin for ProcessRegistry
impl UnsafeUnpin for ProcessRegistry
impl UnwindSafe for ProcessRegistry
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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 more