storage
Storage configuration for LucidLink Python daemon.
This module provides two operational modes for managing daemon files:
- SANDBOXED: Files in temporary directory, always cleaned up on exit
- PHYSICAL: Files in .lucid subfolder, optional persistence
IMPORTANT: Directory Structure
The native C++ daemon automatically manages the directory structure: 1. Python passes the BASE directory to the daemon (e.g., C:/work/script/) 2. Daemon automatically adds the .lucid subdirectory 3. Daemon creates per-filespace UUID subdirectories for isolation
Example with PHYSICAL mode running from C:/work/script/:
1. StorageConfig.get_root_path() returns: C:/work/script/
2. Python passes to daemon: "C:/work/script" (forward slashes)
3. Native daemon creates directory structure:
- C:/work/script/.lucid/{filespace1-uuid}/node.cfg
- C:/work/script/.lucid/{filespace1-uuid}/metadb/
- C:/work/script/.lucid/{filespace1-uuid}/cache/
4. If you link to a second filespace in the same script:
- C:/work/script/.lucid/{filespace2-uuid}/node.cfg
- C:/work/script/.lucid/{filespace2-uuid}/metadb/
- C:/work/script/.lucid/{filespace2-uuid}/cache/
This prevents file clashes when multiple daemon instances link to different filespaces from the same script.
Note: Python passes paths to the daemon using forward slashes (generic format) for cross-platform compatibility, matching the behavior of Android/iOS which use boost::filesystem::generic_string().
- class lucidlink.storage.StorageConfig(mode: StorageMode = StorageMode.SANDBOXED, persist_on_exit: bool = False, root_path: Path | None = None)[source]
Bases:
objectConfiguration for daemon storage mode and file locations.
- Parameters:
mode – Storage mode (
PHYSICALorSANDBOXED)persist_on_exit – If
False, clean up files when daemon stops. Only applies toPHYSICALmode;SANDBOXEDalways cleans up.root_path – Override root path for files (only for
PHYSICALmode). IfNone, uses current working directory.
Example
# Sandboxed mode (default) - temp directory, always cleaned up config = StorageConfig() # Physical mode with cleanup config = StorageConfig(mode=StorageMode.PHYSICAL) # Physical mode with persistence config = StorageConfig( mode=StorageMode.PHYSICAL, persist_on_exit=True ) # Custom root path config = StorageConfig( mode=StorageMode.PHYSICAL, root_path=Path("D:/lucid_data") )