pip_services3_components.lock.ILock module
-
class
pip_services3_components.lock.ILock.ILock Bases:
abc.ABCInterface for locks to synchronize work or parallel processes and to prevent collisions.
The lock allows to manage multiple locks identified by unique keys.
-
acquire_lock(correlation_id: Optional[str], key: str, ttl: int, timeout: int) Releases prevously acquired lock by its key.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique lock key to acquire.
ttl – a lock timeout (time to live) in milliseconds.
timeout – lock timeout
-
release_lock(correlation_id: Optional[str], key: str) Releases prevously acquired lock by its key.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique lock key to acquire.
-
try_acquire_lock(correlation_id: Optional[str], key: str, ttl: int) → bool Makes a single attempt to acquire a lock by its key. It returns immediately a positive or negative result.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique lock key to acquire.
ttl – a lock timeout (time to live) in milliseconds.
- Returns
lock result
-