Skip to main content

MindmapCache

Struct MindmapCache 

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

Manages loading and caching of mindmap files with security validation

Implementations§

Source§

impl MindmapCache

Source

pub fn new(workspace_root: PathBuf) -> Self

Create a new cache with the given workspace root

Source

pub fn workspace_root(&self) -> &Path

Get the workspace root

Source

pub fn load( &mut self, base_file: &Path, relative: &str, visited: &HashSet<PathBuf>, ) -> Result<&Mindmap>

Load a mindmap file with caching

§Arguments
  • base_file - The file that contains the reference (used to resolve relative paths)
  • relative - The relative path to load (e.g., “./MINDMAP.llm.md”)
  • visited - Set of already-visited files (for cycle detection)
§Errors
  • Path traversal attempts (e.g., “../../../etc/passwd”)
  • Absolute paths (POSIX, Windows drive letters, UNC paths)
  • File too large (> max_file_size)
  • File not found
  • Cycle detected (path already in visited set)
Source

pub fn resolve_path(&self, base_file: &Path, relative: &str) -> Result<PathBuf>

Resolve a relative path to a canonical absolute path

Path resolution rules:

  1. Resolve relative to the base_file’s directory
  2. No absolute paths allowed (POSIX /foo, Windows C:\foo, UNC \server\share)
  3. No directory traversal escapes (../../../ blocked)
  4. Final path must be within workspace_root
§Errors
  • Absolute path detected
  • Path escape attempt (outside workspace_root)
  • Path canonicalization failed
Source

pub fn clear(&mut self)

Clear the cache

Source

pub fn stats(&self) -> CacheStats

Get cache statistics

Source

pub fn max_depth(&self) -> usize

Get max recursion depth

Trait Implementations§

Source§

impl Debug for MindmapCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.