Class AlwaysLeaderElection
Standalone fallback for : the current node is always the leader.
NOT cluster-safe. Use only in single-node (standalone) hosting. Register explicitly
via services.AddTsakAlwaysLeaderFallback().
public sealed class AlwaysLeaderElection : ILeaderElection
Inheritance
Implements
Properties
CurrentLeaderNodeId
Node ID of the current leader (null if unknown).
public string? CurrentLeaderNodeId { get; }
Methods
GetLeaderSnapshot()
Returns (IsLeader, Epoch, LeaderNodeId) as ONE consistent snapshot — use this instead of
public LeaderSnapshot GetLeaderSnapshot()
ReleaseAsync(CancellationToken)
Releases the leader lock (graceful step-down): clears local leadership AND the store.
public Task ReleaseAsync(CancellationToken ct = default)
RenewAsync(CancellationToken)
Renews the leader lock TTL. Returns true if renewal succeeded.
public Task<bool> RenewAsync(CancellationToken ct = default)
StepDown()
Local, store-free voluntary step-down: immediately clears this node's leadership flag without
public void StepDown()
TryAcquireAsync(CancellationToken)
Attempts to acquire the leader lock. Returns true if this node became leader.
public Task<bool> TryAcquireAsync(CancellationToken ct = default)