pub struct MemRouterSnapshot { /* private fields */ }Expand description
Mem configuration for the engine runtime — cloneable snapshot.
Tracks which mems are writable, which are visible, and their
directories. Held on Engine behind an Arc<MemRouterSnapshot>;
lifecycle mutations clone the snapshot, edit the clone, and swap the
Arc pointer atomically inside the engine mutex.
Implementations§
Source§impl MemRouterSnapshot
impl MemRouterSnapshot
pub fn new() -> MemRouterSnapshot
Sourcepub fn add_writable(
&mut self,
name: String,
dir: Option<PathBuf>,
origin: MemOrigin,
)
pub fn add_writable( &mut self, name: String, dir: Option<PathBuf>, origin: MemOrigin, )
Register a writable mem with its directory path and origin.
The mem’s hierarchical organisational path is part of name
itself (e.g. "team/sub-mem"). The router HashMap key, the
Mount::mem field, and the lifecycle-allowlist candidate
all converge on the same string — no separate composition
step.
Sourcepub fn remove_writable(&mut self, name: &str) -> bool
pub fn remove_writable(&mut self, name: &str) -> bool
Remove a writable mem from the router. Returns true when
the entry was present.
Internal — called by Engine::unregister_mem_runtime.
Read-only entries are not affected; unregistering a name that
names a read-only mem is a caller-level misuse and returns
false.
Sourcepub fn add_read_only(&mut self, name: String, archive_path: PathBuf)
pub fn add_read_only(&mut self, name: String, archive_path: PathBuf)
Register a read-only mem backed by a sealed .mem archive.
archive_path is the on-disk location of the archive. The
router retains it so reload can re-open the same archive without
re-parsing the project config.
Sourcepub fn remove_read_only(&mut self, name: &str) -> bool
pub fn remove_read_only(&mut self, name: &str) -> bool
Remove a read-only mem from the router. Returns true when the
entry was present. Mirror of Self::remove_writable for the
uninstall path: writable entries are not affected, and visible
only drops the name when no writable entry still carries it.
Sourcepub fn is_writable(&self, mem: &str) -> bool
pub fn is_writable(&self, mem: &str) -> bool
Check if a mem is writable.
Sourcepub fn is_visible(&self, mem: &str) -> bool
pub fn is_visible(&self, mem: &str) -> bool
Check if a mem is visible (writable or read-only).
Sourcepub fn is_entity_visible(&self, entity_id: &EntityId) -> bool
pub fn is_entity_visible(&self, entity_id: &EntityId) -> bool
Check if an entity is visible from the given context.
Sourcepub fn dir_for_mem(&self, mem: &str) -> Option<&Path>
pub fn dir_for_mem(&self, mem: &str) -> Option<&Path>
Get the directory path for a writable mem.
Returns None when the mem is unknown OR when the mem is
mem-repo-backed (no on-disk directory). Callers that need to
distinguish “mem not found” from “mem has no dir” use
is_writable first.
Sourcepub fn origin_for_mem(&self, mem: &str) -> Option<&MemOrigin>
pub fn origin_for_mem(&self, mem: &str) -> Option<&MemOrigin>
Get the MemOrigin for a writable mem. Used by the
MEM_NAME_COLLISION envelope renderer and the
memstead_health { include_config: true } per-mem origin field.
Sourcepub fn archive_path_for_mem(&self, mem: &str) -> Option<&Path>
pub fn archive_path_for_mem(&self, mem: &str) -> Option<&Path>
Get the sealed-archive path for a read-only mem.
Returns None for writable mems and unknown names. Keep this
distinct from dir_for_mem — a directory and a zip archive are
different backing stores, and callers usually care which they get.
Sourcepub fn writable_mems(&self) -> &HashSet<String>
pub fn writable_mems(&self) -> &HashSet<String>
Get all writable mem names.
Sourcepub fn visible_mems(&self) -> &HashSet<String>
pub fn visible_mems(&self) -> &HashSet<String>
Get all visible mem names.
Trait Implementations§
Source§impl Clone for MemRouterSnapshot
impl Clone for MemRouterSnapshot
Source§fn clone(&self) -> MemRouterSnapshot
fn clone(&self) -> MemRouterSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemRouterSnapshot
impl Debug for MemRouterSnapshot
Source§impl Default for MemRouterSnapshot
impl Default for MemRouterSnapshot
Source§fn default() -> MemRouterSnapshot
fn default() -> MemRouterSnapshot
Auto Trait Implementations§
impl Freeze for MemRouterSnapshot
impl RefUnwindSafe for MemRouterSnapshot
impl Send for MemRouterSnapshot
impl Sync for MemRouterSnapshot
impl Unpin for MemRouterSnapshot
impl UnsafeUnpin for MemRouterSnapshot
impl UnwindSafe for MemRouterSnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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 more