pub struct DefinitionStore {
root: PathBuf,
write_lock: Mutex<()>,
}Fields§
§root: PathBuf§write_lock: Mutex<()>Implementations§
Source§impl DefinitionStore
impl DefinitionStore
Sourcepub fn open(root: PathBuf) -> Result<Self, DefStoreError>
pub fn open(root: PathBuf) -> Result<Self, DefStoreError>
Open or create the store rooted at root. Ensures the active dir
and retired/ subdir both exist.
pub fn root(&self) -> &Path
fn active_path(&self, id: &str) -> PathBuf
fn retired_path(&self, id: &str) -> PathBuf
Sourcepub fn upsert(&self, rec: &DefinitionRecord) -> Result<(), DefStoreError>
pub fn upsert(&self, rec: &DefinitionRecord) -> Result<(), DefStoreError>
Insert or update a definition. Preserves unknown top-level + data
fields on an existing file (forward-compat); refuses to overwrite a
corrupt or higher-schema file.
Sourcepub fn retire(&self, id: &str) -> Result<(), DefStoreError>
pub fn retire(&self, id: &str) -> Result<(), DefStoreError>
Soft-delete → move into retired/ (tombstone). Idempotent. The
tombstone prevents another channel’s migration from resurrecting an
agent the user deliberately deleted.
Sourcepub fn unretire(&self, id: &str) -> Result<(), DefStoreError>
pub fn unretire(&self, id: &str) -> Result<(), DefStoreError>
Move a record back from retired/ to active. Idempotent.
Sourcepub fn hard_delete(&self, id: &str) -> Result<(), DefStoreError>
pub fn hard_delete(&self, id: &str) -> Result<(), DefStoreError>
Hard-delete (drops both active and retired files). Mirrors SQLite
agent_def_delete. Use Self::retire when a resurrection-proof
tombstone is wanted instead.
pub fn exists(&self, id: &str) -> bool
pub fn exists_anywhere(&self, id: &str) -> bool
Sourcepub fn get(&self, id: &str) -> Result<Option<DefinitionRecord>, DefStoreError>
pub fn get(&self, id: &str) -> Result<Option<DefinitionRecord>, DefStoreError>
Read a single active definition record by id. None if absent;
invalid/corrupt files surface as an error (caller logs + falls back).
Sourcepub fn list_active(&self) -> Result<Vec<DefinitionRecord>, DefStoreError>
pub fn list_active(&self) -> Result<Vec<DefinitionRecord>, DefStoreError>
Read every valid active definition. Invalid files are skipped + logged (left on disk for ops triage).
Auto Trait Implementations§
impl !Freeze for DefinitionStore
impl RefUnwindSafe for DefinitionStore
impl Send for DefinitionStore
impl Sync for DefinitionStore
impl Unpin for DefinitionStore
impl UnwindSafe for DefinitionStore
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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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