Class InProcessLock

Assembly: redb.Tsak.Core.Pro.dll

In-process implementation of intended for standalone hosting.
Holds locks in a ; epoch is a monotonically
increasing counter per (group, lockName).

NOT cluster-safe. Use only when Tsak:Cluster:Enabled=false. The first acquire
emits a single WRN log so operators can see the fallback is active.


Register explicitly via services.AddTsakInProcessLockFallback() — the framework does
not register this automatically to avoid silent "works in standalone, broken in cluster"
surprises.

public sealed class InProcessLock : IDistributedLock

Inheritance

Object→InProcessLock

Implements

Methods

ReleaseAsync(string, string, string, CancellationToken)

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

public 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.

public 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.

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

Constructors