LeaseConsumer
Represents client side of a lease in a distributed environment.
Represents a result of lease acquisition operation.
Gets or sets wall clock desync degree in the cluster.
Gets lease expiration timeout.
Gets the token bounded to the lease lifetime.
Initializes a new lease consumer.
public ValueTask AcquireAsync(TimeSpan pauseDuration, Random pauseRandomizer = null, CancellationToken token = default)
Acquires the lease.
public Task<TResult> ExecuteAsync<TResult>(Func<CancellationToken, Task<TResult>> worker, CancellationToken token = default)
Executes the specified long-running operation that is protected by the lease lifetime.
Releases a lease.
protected abstract ValueTask<LeaseIdentity?> ReleaseCoreAsync(LeaseIdentity identity, CancellationToken token)
Performs a call to ReleaseAsync across
the application boundaries.
Tries to acquire the lease.
protected abstract ValueTask<AcquisitionResult?> TryAcquireCoreAsync(CancellationToken token = default)
Performs a call to TryAcquireAsync across the application boundaries.
Tries to renew a lease.
protected abstract ValueTask<AcquisitionResult?> TryRenewCoreAsync(LeaseIdentity identity, CancellationToken token)
Performs a call to TryRenewAsync or
TryAcquireOrRenewAsync across the application boundaries.