workspace

Workspace context after successful authentication.

class lucidlink.workspace.Workspace(workspace_id: str, workspace_name: str)[source]

Bases: object

Workspace 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 to a filespace in this workspace.

You must provide either name OR id, but not both.

Parameters:
  • name – Filespace name (either name or id required)

  • id – Filespace ID (either name or id required)

  • root_path – Mount point path (default: "/")

  • sync_mode – 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:
  • ValueError – If neither name nor id provided, or both provided

  • FileNotFoundError – 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.

stop() None[source]

Stop workspace — unlinks active filespace if any.

If sync_mode is SYNC_ALL, calls sync_all() before unlinking. Safe to call multiple times.