workspace
Workspace context after successful authentication.
- class lucidlink.workspace.Workspace(workspace_id: str, workspace_name: str)[source]
Bases:
objectWorkspace context after successful authentication.
Provides access to filespace operations within the authenticated workspace. Returned by
Daemon.authenticate().Example
credentials = ServiceAccountCredentials(token) workspace = daemon.authenticate(credentials) print(workspace.id, workspace.name)
- property id: str
Get the workspace ID.
- link_filespace(name: str | None = None, id: str | None = None, root_path: str = '/', sync_mode: SyncMode = SyncMode.SYNC_ALL)[source]
Link to a filespace in this workspace.
You must provide either
nameORid, but not both.- Parameters:
name – Filespace name (either
nameoridrequired)id – Filespace ID (either
nameoridrequired)root_path – Mount point path (default:
"/")sync_mode – Controls automatic sync on close.
SYNC_ALL(default) callssync_all()before unlinking.SYNC_NONEskips automatic sync — caller must callsync_all()explicitly.
- Returns:
Filespaceobject for filesystem operations- Raises:
ValueError – If neither
namenoridprovided, or both providedFileNotFoundError – If filespace not found
PermissionDeniedError – If service account lacks access
RuntimeError – If daemon not running or not authenticated
Example
# Link by name (user-friendly) fs = workspace.link_filespace(name="production-data") # Link by ID (efficient if you have the UUID) fs = workspace.link_filespace(id="fs-uuid-12345") # Using as context manager (auto sync + unlink on exit) with workspace.link_filespace(name="data") as fs: fs.fs.write_file("/file.txt", b"data") # sync_all() + unlink() called automatically # Disable auto-sync fs = workspace.link_filespace(name="data", sync_mode=SyncMode.SYNC_NONE)
- list_filespaces() List[FilespaceInfo][source]
List all filespaces in this workspace.
- Returns:
List of FilespaceInfo objects with id, name, and created timestamp.
- Raises:
ConnectionError – If WebService unreachable
AuthenticationError – If access token expired
RuntimeError – If daemon not running
Example
filespaces = workspace.list_filespaces() for fs in filespaces: print(f"{fs.name}")
- property name: str
Get the workspace name.