pub struct LoopRegistry { /* private fields */ }Expand description
Registry for tracking active Ralph loops.
Provides thread-safe registration and discovery of running loops.
Implementations§
Source§impl LoopRegistry
impl LoopRegistry
Sourcepub const REGISTRY_FILE: &'static str = ".ralph/loops.json"
pub const REGISTRY_FILE: &'static str = ".ralph/loops.json"
The relative path to the registry file within the workspace.
Sourcepub fn new(workspace_root: impl AsRef<Path>) -> Self
pub fn new(workspace_root: impl AsRef<Path>) -> Self
Creates a new registry instance for the given workspace.
Sourcepub fn register(&self, entry: LoopEntry) -> Result<String, RegistryError>
pub fn register(&self, entry: LoopEntry) -> Result<String, RegistryError>
Registers a new loop entry.
Returns the entry’s ID for later deregistration.
Sourcepub fn deregister(&self, id: &str) -> Result<(), RegistryError>
pub fn deregister(&self, id: &str) -> Result<(), RegistryError>
Deregisters a loop by ID.
Sourcepub fn get(&self, id: &str) -> Result<Option<LoopEntry>, RegistryError>
pub fn get(&self, id: &str) -> Result<Option<LoopEntry>, RegistryError>
Gets a loop entry by ID.
Sourcepub fn list(&self) -> Result<Vec<LoopEntry>, RegistryError>
pub fn list(&self) -> Result<Vec<LoopEntry>, RegistryError>
Lists all active loops (after cleaning stale entries).
Sourcepub fn clean_stale(&self) -> Result<usize, RegistryError>
pub fn clean_stale(&self) -> Result<usize, RegistryError>
Cleans stale entries (dead PIDs) and returns the number removed.
Sourcepub fn deregister_current_process(&self) -> Result<bool, RegistryError>
pub fn deregister_current_process(&self) -> Result<bool, RegistryError>
Deregisters all entries for the current process.
This is useful for cleanup on termination, since each process can only have one active loop entry.
Auto Trait Implementations§
impl Freeze for LoopRegistry
impl RefUnwindSafe for LoopRegistry
impl Send for LoopRegistry
impl Sync for LoopRegistry
impl Unpin for LoopRegistry
impl UnsafeUnpin for LoopRegistry
impl UnwindSafe for LoopRegistry
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