< Summary - AsyncResponse (Release / net8.0+net10.0 / unit+integration)

Information
Class: AsyncResponse.FlowLeaseObservation
Assembly: AsyncResponse.Abstractions
File(s): /_/src/AsyncResponse.Abstractions/FlowLeaseObservation.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 36
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Unheld()100%11100%
.ctor(...)100%11100%
get_LeaseId()100%11100%
get_ExpiresAtUtc()100%11100%

File(s)

/_/src/AsyncResponse.Abstractions/FlowLeaseObservation.cs

#LineLine coverage
 1namespace AsyncResponse;
 2
 3/// <summary>
 4/// The execution lease a store has persisted for one flow ledger, exactly as stored: who holds it
 5/// and until when. Returned by <see cref="IFlowStateStore.ObserveLeaseAsync"/>.
 6/// <para>
 7/// The engine never judges <see cref="ExpiresAtUtc"/> against its own clock to decide ownership —
 8/// that stays the store's job in <see cref="IFlowStateStore.TryAcquireLeaseAsync"/>. It compares
 9/// two observations of the same ledger with each other: a different <see cref="LeaseId"/>, or a
 10/// later <see cref="ExpiresAtUtc"/> under the same id, can only have been written by a worker that
 11/// acquired or renewed the lease in between, which is the proof of a live holder that a waiter's
 12/// own lease configuration cannot give.
 13/// </para>
 14/// </summary>
 15public sealed class FlowLeaseObservation
 16{
 17    /// <summary>The observation of a ledger nobody holds (never leased, released, or absent).</summary>
 22418    public static FlowLeaseObservation Unheld { get; } = new(null, null);
 19
 20    /// <param name="leaseId">The persisted lease owner, or <c>null</c> when no lease is held.</param>
 21    /// <param name="expiresAtUtc">The persisted lease expiry, or <c>null</c> when no lease is held.</param>
 77122    public FlowLeaseObservation(string? leaseId, DateTime? expiresAtUtc)
 23    {
 77124        LeaseId = leaseId;
 77125        ExpiresAtUtc = expiresAtUtc;
 77126    }
 27
 28    /// <summary>The persisted lease owner; <c>null</c> when no lease is held.</summary>
 1286529    public string? LeaseId { get; }
 30
 31    /// <summary>
 32    /// The persisted lease expiry (UTC), possibly already in the past — an expired lease stays on
 33    /// the row until someone acquires or releases it. <c>null</c> when no lease is held.
 34    /// </summary>
 890635    public DateTime? ExpiresAtUtc { get; }
 36}