Skip to main content

BondManager

Struct BondManager 

Source
pub struct BondManager { /* private fields */ }
Expand description

SQLite-backed manager for Bonds.

Keep this file as the module root and shared type definition. Concern-specific method implementations live in sibling modules.

Implementations§

Source§

impl BondManager

Health-scan concerns.

Source

pub fn scan_broken_bonds(&self) -> Result<Vec<Bond>, BondError>

Return broken bonds and emit BrokenDetected event for each.

Source§

impl BondManager

Hook registration and dispatch concerns.

Source

pub fn register_hook<H>(&self, hook: H)
where H: BondEventHook + 'static,

Register closure/type-based hook.

Source

pub fn register_hook_arc(&self, hook: Arc<dyn BondEventHook>)

Register Arc-wrapped hook implementation.

Source§

impl BondManager

Create/update/delete and metadata mutation flows.

Source

pub fn create_bond<P: AsRef<Path>, Q: AsRef<Path>>( &self, source: P, target: Q, name: Option<String>, ) -> Result<Bond, BondError>

Create a symlink bond and persist it (no metadata).

Source

pub fn create_bond_with_metadata<P: AsRef<Path>, Q: AsRef<Path>>( &self, source: P, target: Q, name: Option<String>, metadata: Option<HashMap<String, String>>, ) -> Result<Bond, BondError>

Create a symlink bond with metadata and persist it.

Source

pub fn update_bond( &self, id: &str, new_source: Option<PathBuf>, new_target: Option<PathBuf>, new_name: Option<String>, ) -> Result<Bond, BondError>

Update source and/or target and/or name.

Source

pub fn update_bond_metadata( &self, identifier: &str, metadata: Option<HashMap<String, String>>, ) -> Result<Bond, BondError>

Replace full metadata map. Use None to clear.

Source

pub fn delete_bond( &self, id: &str, remove_target: bool, ) -> Result<Bond, BondError>

Delete bond and optionally remove non-symlink target.

Source§

impl BondManager

Query and filtering concerns.

Source

pub fn query_bonds(&self, query: &BondQuery) -> Result<Vec<Bond>, BondError>

Query bonds using optional source/target/metadata filters (AND semantics).

Source

pub fn query_by_source<P: AsRef<Path>>( &self, source: P, ) -> Result<Vec<Bond>, BondError>

Source

pub fn query_by_target<P: AsRef<Path>>( &self, target: P, ) -> Result<Vec<Bond>, BondError>

Source

pub fn query_by_metadata_key(&self, key: &str) -> Result<Vec<Bond>, BondError>

Source

pub fn query_by_metadata( &self, key: &str, value: &str, ) -> Result<Vec<Bond>, BondError>

Source§

impl BondManager

Storage/open/read/schema concerns for BondManager.

Source

pub fn new(db_path: Option<PathBuf>) -> Result<Self, BondError>

Open (or create) the DB at db_path. If None, defaults to $HOME/.bonds/bonds.db.

Source

pub fn list_bonds(&self) -> Result<Vec<Bond>, BondError>

List all bonds (most-recent first).

Source

pub fn get_bond(&self, identifier: &str) -> Result<Bond, BondError>

Get a single bond by ID or name. ID can be a unique prefix.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.