yera.creds.locking

Cross-process locking for protected credential stores.

Symbols

class SecretStoreLock — Coordinate access to one credential store across processes.

SecretStoreLock

Coordinate access to one credential store across processes.

Methods

__init__ — Create a lock for one credential store.
__enter__ — Acquire the store lock.
__exit__ — Release the store lock.

SecretStoreLock.__init__

__init__(
    path: Path,
    timeout: float = 0,
) → None

Create a lock for one credential store.

Parameters

path
type: Path

Stable lock-file path beside the credential store.

timeout
type: float = 0

Seconds to wait before reporting contention.

SecretStoreLock.__enter__

__enter__() → Self

Acquire the store lock.

Returns

type: Self

The acquired lock.

Raises

SecretStoreBusyError

If the lock cannot be acquired in time.

SecretStoreUnsafeError

If the lock path is unsafe.

SecretStoreLock.__exit__

__exit__(
    exception_type: type[BaseException] | None,
    exception: BaseException | None,
    traceback: TracebackType | None,
) → None

Release the store lock.

Parameters

exception_type
type: type[BaseException] | None

Type of exception leaving the context, if any.

exception
type: BaseException | None

Exception leaving the context, if any.

traceback
type: TracebackType | None

Traceback associated with the exception, if any.