daemon

LucidLink Python Library - Daemon Management

High-level Pythonic wrapper for the LucidLink daemon. Provides context manager support for daemon lifecycle management.

class lucidlink.daemon.Daemon(config: Dict[str, str] | None = None, storage: StorageConfig | None = None)[source]

Bases: object

High-level Python wrapper for the LucidLink daemon.

The Daemon class manages the lifecycle of the LucidLink daemon process, handles authentication, and provides access to workspaces and filespaces.

Example

from lucidlink import Daemon, ServiceAccountCredentials

# Create credentials
credentials = ServiceAccountCredentials(token="sa_live:your_key")

# Start daemon and authenticate
daemon = Daemon(config)
daemon.start()
workspace = daemon.authenticate(credentials)

# List and link to filespace
filespaces = workspace.list_filespaces()
filespace = workspace.link_filespace(name="production-data")

# Use filesystem
entries = filespace.fs.read_dir("/")

# Cleanup
daemon.stop()
authenticate(credentials: ServiceAccountCredentials) Workspace[source]

Authenticate to LucidLink using service account credentials.

Must call start() before authenticate().

Parameters:

credentials – ServiceAccountCredentials object containing the service account token

Returns:

Workspace object providing access to filespace operations

Raises:

Example

from lucidlink import Daemon, ServiceAccountCredentials
credentials = ServiceAccountCredentials(token="sa_live:your_key")
daemon = Daemon()
daemon.start()
workspace = daemon.authenticate(credentials)
print(workspace.name)
is_running() bool[source]

Check if the daemon is currently running.

Returns:

True if daemon is started, False otherwise

start() None[source]

Start the daemon services.

Must be called before authentication or filespace linking. Safe to call multiple times - subsequent calls are no-ops.

Note: Only one daemon can be active per process due to C++ global state. Attempting to start a second daemon while one is already running will raise DaemonError.

Raises:

DaemonError – If daemon start fails or another daemon is already active

stop() None[source]

Stop the daemon and cleanup resources.

Automatically unlinks any linked filespaces before stopping. Cleans up operational files based on storage configuration: - SANDBOXED mode: Always cleans up temp directory - PHYSICAL mode: Cleans up if persist_on_exit=False

Safe to call multiple times - subsequent calls are no-ops.

Raises:

DaemonError – If daemon stop fails