storage
Storage configuration for the LucidLink Python client.
This module provides two operational modes for managing client files:
SANDBOXED: Files in temporary directory, always cleaned up on exitPHYSICAL: Files in.lucidsubfolder, optional persistence
IMPORTANT: Directory Structure
The client automatically manages the directory structure:
Python passes the BASE directory (e.g., C:/work/script/).
The
.lucidsubdirectory is appended automatically.Per-filespace UUID subdirectories are created for isolation.
Example with PHYSICAL mode running from C:/work/script/:
1. StorageConfig.get_root_path() returns: C:/work/script/
2. Python passes the base path: "C:/work/script" (forward slashes)
3. The following directory structure is created:
- 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 clients link to different filespaces from the same script.
Note: Paths are passed using forward slashes (generic format) for cross-platform compatibility.
- class lucidlink.storage.StorageConfig(mode: StorageMode = StorageMode.SANDBOXED, persist_on_exit: bool = False, root_path: Path | None = None)[source]
Bases:
objectConfiguration for client storage mode and file locations.
- Parameters:
mode – Storage mode (
PHYSICALorSANDBOXED)persist_on_exit – If
False, clean up files when the client closes. 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") )