pub struct Registry {
root: PathBuf,
write_lock: Mutex<()>,
}Fields§
§root: PathBuf§write_lock: Mutex<()>Implementations§
Source§impl Registry
impl Registry
Sourcepub fn open(root: PathBuf) -> Result<Self, RegistryError>
pub fn open(root: PathBuf) -> Result<Self, RegistryError>
Open or create the registry rooted at root. Ensures the
active dir and retired/ subdir both exist.
pub fn root(&self) -> &Path
Sourcepub fn agents_root(&self) -> Option<&Path>
pub fn agents_root(&self) -> Option<&Path>
Resolved <shared_home>/agents/ — one level above root.
Used by callers that need to express working-directory paths
as relative subpaths under the shared agents tree. Returns
None if the registry root has no parent (only happens in
pathological filesystem-root setups; production always nests
under ~/.agentmux/agents/registry).
fn active_path(&self, instance_id: &str) -> PathBuf
fn retired_path(&self, instance_id: &str) -> PathBuf
Sourcepub fn upsert(&self, rec: &NamedAgentRecord) -> Result<(), RegistryError>
pub fn upsert(&self, rec: &NamedAgentRecord) -> Result<(), RegistryError>
Insert or update a record. If the file already exists, unknown
top-level + data fields are preserved (forward-compat with
future schemas that add columns this binary doesn’t know).
Forward-compat invariant (spec §6): never write a higher-schema
row into a lower schema, never overwrite a corrupt/unparseable
file. Both cases skip the mirror with a warning — the on-disk
file stays intact for the binary that authored it (or for ops
triage). Skipping is Ok(()): SQLite remains authoritative.
Sourcepub fn retire(&self, instance_id: &str) -> Result<(), RegistryError>
pub fn retire(&self, instance_id: &str) -> Result<(), RegistryError>
Move record into retired/ (soft delete — keeps the working
dir intact, drops it from the launch-modal dropdown). Idempotent.
Sourcepub fn unretire(&self, instance_id: &str) -> Result<(), RegistryError>
pub fn unretire(&self, instance_id: &str) -> Result<(), RegistryError>
Move record back from retired/ to active. Idempotent.
Sourcepub fn hard_delete(&self, instance_id: &str) -> Result<(), RegistryError>
pub fn hard_delete(&self, instance_id: &str) -> Result<(), RegistryError>
Hard-delete (drops both active and retired files). Mirrors
SQLite instance_delete.
Sourcepub fn exists(&self, instance_id: &str) -> bool
pub fn exists(&self, instance_id: &str) -> bool
Whether an active record exists for instance_id. Doesn’t
validate — useful for migration idempotency checks. Use
Self::exists_anywhere when retired records should also
count (e.g. so migration doesn’t resurrect a hidden agent).
Sourcepub fn exists_anywhere(&self, instance_id: &str) -> bool
pub fn exists_anywhere(&self, instance_id: &str) -> bool
Whether a record exists in either active or retired. Used by
migration to skip already-tombstoned records (avoid
resurrecting a user’s deliberate “Forget agent” via a
per-version SQLite row that still has display_hidden = 0).
Sourcepub fn list_active(&self) -> Result<Vec<NamedAgentRecord>, RegistryError>
pub fn list_active(&self) -> Result<Vec<NamedAgentRecord>, RegistryError>
Read every valid active record. Invalid files are skipped + logged. PR A doesn’t wire this into the RPC path; included so PR B can swap reads over without further restructuring.
Auto Trait Implementations§
impl !Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnwindSafe for Registry
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.