pub struct MountManager { /* private fields */ }Expand description
Manages Mounts: CRUD, lookup, and detection.
Mounts are persisted in the mounts SQLite table
(same memory.db as memories and the legacy projects table).
Implementations§
Source§impl MountManager
impl MountManager
Sourcepub fn new(db: Arc<MemoryDatabase>, event_bus: Option<EventBus>) -> Result<Self>
pub fn new(db: Arc<MemoryDatabase>, event_bus: Option<EventBus>) -> Result<Self>
Create a new MountManager, loading existing Mounts from SQLite.
Sourcepub fn list_mounts(&self) -> Vec<Mount>
pub fn list_mounts(&self) -> Vec<Mount>
List all Mounts.
Sourcepub fn get_mount_by_name(&self, name: &str) -> Option<Mount>
pub fn get_mount_by_name(&self, name: &str) -> Option<Mount>
Get a Mount by name.
Sourcepub fn get_mounts_ordered(&self, ids: &[MountId]) -> Vec<Mount>
pub fn get_mounts_ordered(&self, ids: &[MountId]) -> Vec<Mount>
Get several Mounts by ID, preserving the request order. Missing IDs are skipped (they may have been deleted).
Sourcepub fn create_mount(
&self,
name: String,
paths: Vec<PathBuf>,
source: MountSource,
) -> Result<Mount>
pub fn create_mount( &self, name: String, paths: Vec<PathBuf>, source: MountSource, ) -> Result<Mount>
Create a new Mount with the minimal RFC-025 input (name + paths).
Sourcepub fn update_enrichment(
&self,
id: MountId,
auto_description: Option<String>,
auto_meta: Option<MountMeta>,
) -> Result<Mount>
pub fn update_enrichment( &self, id: MountId, auto_description: Option<String>, auto_meta: Option<MountMeta>, ) -> Result<Mount>
Update a Mount’s auto-enriched fields (agent-driven, RFC-025 Phase 3).
Only auto_description and auto_meta are writable here — name and
paths are user-level and go through Self::rename / the web API.
Sourcepub fn remove_mount(&self, id: MountId) -> Result<()>
pub fn remove_mount(&self, id: MountId) -> Result<()>
Remove a Mount.
DB-first ordering (matches create_mount): if the DB delete fails the
in-memory state is left untouched so the caller can retry and the Mount
doesn’t silently reappear on restart.
If the Mount was AutoPromoted, its canonicalized root paths are
recorded as dismissals (tombstones) so the background scanner does
not immediately re-promote them (Promo-3). Manual mounts are removed
without recording a tombstone (the user may still want auto-promotion
for that root).
Sourcepub fn detect(&self, message: &str) -> DetectionResult
pub fn detect(&self, message: &str) -> DetectionResult
Try to detect a Mount from a user message.
Sourcepub fn seed_auto_meta(&self, id: MountId) -> Result<()>
pub fn seed_auto_meta(&self, id: MountId) -> Result<()>
Seed auto_meta from the filesystem (RFC-025 §Auto-Meta).
Cheap heuristic detection on marker files. The agent refines this during enrichment. Idempotent — safe to call multiple times.
Sourcepub fn check_drift(&self, id: MountId) -> Result<bool>
pub fn check_drift(&self, id: MountId) -> Result<bool>
Check marker-file drift and set enrichment_pending (RFC-025 §Enrichment).
Compares current marker mtimes against the stored snapshot. Returns
true if any marker drifted (and the flag was set). Cheap: a handful
of stat() calls.
Sourcepub fn check_all_drift(&self) -> Vec<MountId> ⓘ
pub fn check_all_drift(&self) -> Vec<MountId> ⓘ
Check drift for all Mounts (Dream-time refresh, RFC-025).
Returns the IDs of Mounts whose content drifted.
Sourcepub fn promote_frequent_paths(
&self,
sessions: &[Session],
config: &PromotionConfig,
) -> Vec<MountId> ⓘ
pub fn promote_frequent_paths( &self, sessions: &[Session], config: &PromotionConfig, ) -> Vec<MountId> ⓘ
RFC-025 Phase 5: scan session history and auto-create Mounts for paths that cross the frequency threshold.
Returns the IDs of newly-created Mounts (empty if none promoted). Safe to call repeatedly — paths already covered by an existing Mount are skipped, as are name collisions.
Auto Trait Implementations§
impl !Freeze for MountManager
impl !RefUnwindSafe for MountManager
impl !UnwindSafe for MountManager
impl Send for MountManager
impl Sync for MountManager
impl Unpin for MountManager
impl UnsafeUnpin for MountManager
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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 moreimpl<T> MaybeSendSync for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.