workspace
Workspace context after successful authentication.
lucidlink.workspace.Workspace
Workspace(workspace_id: str, workspace_name: str, notification_watcher = None)Parameter | Description |
|---|---|
| Workspace ID |
| Workspace name |
| The client's daemon-notification watcher; this workspace subscribes itself as its handler (internal use) |
workspace_id
Description
Workspace ID
workspace_name
Description
Workspace name
notification_watcher
Description
The client's daemon-notification watcher; this workspace subscribes itself as its handler (internal use)
Workspace context after successful authentication.
Provides access to filespace operations within the authenticated workspace. Returned by Daemon.authenticate().
Multiple filespaces can be linked concurrently — each link_filespace() call returns an independent Filespace that stays usable until it is unlinked.
Example
credentials = ServiceAccountCredentials(token)client.login(credentials)workspace = client.get_workspace(client.list_workspaces()[0].id)print(workspace.id, workspace.name)
id: str
Get the workspace ID.
linked_filespaces: List[Filespace]
Get the currently linked Filespace objects.
name: str
Get the workspace name.
link_filespace(name: Optional[str] = None, id: Optional[str] = None, root_path: str = '/', sync_mode: SyncMode = SyncMode.SYNC_ALL)
Link to a filespace in this workspace.
You must provide either name OR id, but not both.
Multiple filespaces can be linked at the same time: linking a second filespace does NOT unlink the first one. Each linked filespace runs a full client stack — expect roughly one disk cache default 1024 MB) plus a set of worker threads per link.
Linking a filespace that is already linked is idempotent and returns the existing live Filespace object. One nuance: in the brief window between a link's internal-error teardown and the watcher thread dispatching its notification (see FilespaceInternalError) the stale entry is still returned; once the notification marks it, it is dropped and a retry links fresh.
Parameters
Parameter | Description |
|---|---|
| Filespace name. Deprecated. Pass id instead — a filespace name is mutable while its id is stable, so a script that worked yesterday silently links to nothing (or the wrong filespace) after a rename. |
| Filespace ID (recommended). Stable for the lifetime of the filespace. |
| Mount point path (default: "/") |
| Controls automatic sync on close. SYNC_ALL (default) calls sync_all() before unlinking. SYNC_NONE skips automatic sync — caller must call sync_all() explicitly. |
name
Description
Filespace name. Deprecated. Pass id instead — a filespace name is mutable while its id is stable, so a script that worked yesterday silently links to nothing (or the wrong filespace) after a rename.
id
Description
Filespace ID (recommended). Stable for the lifetime of the filespace.
root_path
Description
Mount point path (default: "/")
sync_mode
Description
Controls automatic sync on close. SYNC_ALL (default) calls sync_all() before unlinking. SYNC_NONE skips automatic sync — caller must call sync_all() explicitly.
Returns
Filespace object for filesystem operations
Raises
Exception | Condition |
|---|---|
| If neither name nor id provided, or both provided |
| If filespace not found |
| If service account lacks access |
| If the client is not running or not authenticated |
ValueError
Condition
If neither name nor id provided, or both provided
FileNotFoundError
Condition
If filespace not found
PermissionDeniedError
Condition
If service account lacks access
RuntimeError
Condition
If the client is not running or not authenticated
Example
# Link by ID (recommended — stable across renames)fs = workspace.link_filespace(id="fs-uuid-12345")# Link a second filespace — both stay usable concurrentlyfs2 = workspace.link_filespace(id="fs-uuid-67890")# Using as context manager (auto sync + unlink on exit)with workspace.link_filespace(id="fs-uuid-12345") as fs:fs.fs.write_file("/file.txt", b"data")# sync_all() + unlink() called automatically# Disable auto-syncfs = workspace.link_filespace(id="fs-uuid-12345", sync_mode=SyncMode.SYNC_NONE)# Deprecated: link by name (emits DeprecationWarning)fs = workspace.link_filespace(name="production-data")
list_filespaces() -> List[FilespaceInfo]
List all filespaces in this workspace.
Returns
List of FilespaceInfo objects with id, name, and created timestamp.
Raises
Exception | Condition |
|---|---|
| If LucidLink services are unreachable |
If access token expired | |
| If the client is not running |
ConnectionError
Condition
If LucidLink services are unreachable
RuntimeError
Condition
If the client is not running
Example
filespaces = workspace.list_filespaces()for fs in filespaces:print(f"{fs.name}")
stop() -> None
Stop workspace — unlinks all linked filespaces.
If a filespace's sync_mode is SYNC_ALL, sync_all() is called before it is unlinked. Per-filespace unlink errors are swallowed so one failing link never blocks the others. Safe to call multiple times.
unlink_filespace(linked) -> None
Unlink the link identified by a native LinkedFilespace handle.
Forwarded from Daemon.unlink_filespace. When the handle maps to a tracked Filespace the teardown goes through it, so the link bookkeeping (the _linked_filespaces / _aliases entries) is dropped via the usual unlink callback. An untracked handle falls back to a direct native unlink so a live link is never leaked.
Users should call filespace.unlink() instead.