pub struct MindmapCache { /* private fields */ }Expand description
Manages loading and caching of mindmap files with security validation
Implementations§
Source§impl MindmapCache
impl MindmapCache
Sourcepub fn workspace_root(&self) -> &Path
pub fn workspace_root(&self) -> &Path
Get the workspace root
Sourcepub fn load(
&mut self,
base_file: &Path,
relative: &str,
visited: &HashSet<PathBuf>,
) -> Result<&Mindmap>
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)
Sourcepub fn resolve_path(&self, base_file: &Path, relative: &str) -> Result<PathBuf>
pub fn resolve_path(&self, base_file: &Path, relative: &str) -> Result<PathBuf>
Resolve a relative path to a canonical absolute path
Path resolution rules:
- Resolve relative to the base_file’s directory
- No absolute paths allowed (POSIX /foo, Windows C:\foo, UNC \server\share)
- No directory traversal escapes (../../../ blocked)
- Final path must be within workspace_root
§Errors
- Absolute path detected
- Path escape attempt (outside workspace_root)
- Path canonicalization failed
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MindmapCache
impl RefUnwindSafe for MindmapCache
impl Send for MindmapCache
impl Sync for MindmapCache
impl Unpin for MindmapCache
impl UnwindSafe for MindmapCache
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
Mutably borrows from an owned value. Read more