OpenrelikWorkerCommon. MountUtils. RedisLock
(openrelik_worker_common v0.1.0)
Copy Markdown
View Source
Distributed Redis lock for NBD device coordination across containers/nodes,
matching Python redis.lock.Lock (name, timeout, token, acquire/1, release/1).
Summary
Functions
Attempts to acquire the Redis lock non-blockingly (SET name token NX EX timeout).
Creates a new RedisLock struct.
Releases the Redis lock if still owned by token.
Types
@type t() :: %OpenrelikWorkerCommon.MountUtils.RedisLock{ client: term(), name: String.t(), timeout: pos_integer(), token: String.t() }
Functions
Attempts to acquire the Redis lock non-blockingly (SET name token NX EX timeout).
@spec new(term(), String.t(), pos_integer()) :: t()
Creates a new RedisLock struct.
@spec release(t()) :: :ok
Releases the Redis lock if still owned by token.