Interface IDistributedLock

Assembly: redb.Tsak.Core.Pro.dll

Distributed lock service using the redb object store with TTL-based expiry.
Provides atomic compare-and-swap via row-level locking (FOR UPDATE / UPDLOCK).
Thread-safe. Each operation uses its own DI scope and transaction.

public interface IDistributedLock

Methods

ReleaseAsync(string, string, string, CancellationToken)

Releases a lock owned by the specified node. Deletes the lock record.

Task ReleaseAsync(string lockName, string ownerNodeId, string groupName, CancellationToken ct = default)

RenewAsync(string, string, string, long, int, CancellationToken)

Renews a lock owned by the specified node. Verifies epoch fencing.

Task<bool> RenewAsync(string lockName, string ownerNodeId, string groupName, long expectedEpoch, int ttlSeconds, CancellationToken ct = default)

TryAcquireAsync(string, string, string, int, CancellationToken)

Attempts to acquire or renew a named lock. Atomic via row-level lock.

Task<LockResult> TryAcquireAsync(string lockName, string ownerNodeId, string groupName, int ttlSeconds, CancellationToken ct = default)