< Summary

Information
Class: AsiBackbone.Core.Outbox.GovernanceOutboxClaimRequest
Assembly: AsiBackbone.Core
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Core/Outbox/GovernanceOutboxClaimRequest.cs
Line coverage
100%
Covered lines: 26
Uncovered lines: 0
Coverable lines: 26
Total lines: 80
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
.ctor(...)100%44100%
get_WorkerId()100%11100%
get_UtcNow()100%11100%
get_LeaseDuration()100%11100%
get_MaxCount()100%11100%
get_ClaimExpiresUtc()100%11100%
Create(...)100%44100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Core/Outbox/GovernanceOutboxClaimRequest.cs

#LineLine coverage
 1namespace AsiBackbone.Core.Outbox;
 2
 3/// <summary>
 4/// Describes an opt-in governance outbox claim and lease request.
 5/// </summary>
 6/// <remarks>
 7/// Claim requests are used by claim-capable stores to coordinate scaled workers before provider emission. They do not c
 8/// </remarks>
 9public sealed class GovernanceOutboxClaimRequest
 10{
 11    /// <summary>
 12    /// Gets the default lease duration for claimed outbox work.
 13    /// </summary>
 514    public static readonly TimeSpan DefaultLeaseDuration = TimeSpan.FromMinutes(5);
 15
 17416    private GovernanceOutboxClaimRequest(
 17417        string workerId,
 17418        DateTimeOffset utcNow,
 17419        TimeSpan leaseDuration,
 17420        int maxCount)
 21    {
 17422        ArgumentException.ThrowIfNullOrWhiteSpace(workerId);
 23
 17224        if (leaseDuration <= TimeSpan.Zero)
 25        {
 426            throw new ArgumentOutOfRangeException(nameof(leaseDuration), leaseDuration, "Lease duration must be greater 
 27        }
 28
 16829        if (maxCount <= 0)
 30        {
 431            throw new ArgumentOutOfRangeException(nameof(maxCount), maxCount, "Maximum count must be greater than zero."
 32        }
 33
 16434        WorkerId = workerId.Trim();
 16435        UtcNow = utcNow.ToUniversalTime();
 16436        LeaseDuration = leaseDuration;
 16437        MaxCount = maxCount;
 16438    }
 39
 40    /// <summary>
 41    /// Gets the stable worker, process, node, or partition owner identifier requesting the claim.
 42    /// </summary>
 44043    public string WorkerId { get; }
 44
 45    /// <summary>
 46    /// Gets the UTC timestamp used for eligibility and lease expiration calculations.
 47    /// </summary>
 142648    public DateTimeOffset UtcNow { get; }
 49
 50    /// <summary>
 51    /// Gets the requested claim lease duration.
 52    /// </summary>
 44253    public TimeSpan LeaseDuration { get; }
 54
 55    /// <summary>
 56    /// Gets the maximum number of entries to claim.
 57    /// </summary>
 66858    public int MaxCount { get; }
 59
 60    /// <summary>
 61    /// Gets the UTC timestamp at which the requested lease expires.
 62    /// </summary>
 263    public DateTimeOffset ClaimExpiresUtc => UtcNow.Add(LeaseDuration);
 64
 65    /// <summary>
 66    /// Creates a claim request with normalized worker and timing values.
 67    /// </summary>
 68    public static GovernanceOutboxClaimRequest Create(
 69        string workerId,
 70        DateTimeOffset? utcNow = null,
 71        TimeSpan? leaseDuration = null,
 72        int maxCount = 100)
 73    {
 17474        return new GovernanceOutboxClaimRequest(
 17475            workerId,
 17476            utcNow ?? DateTimeOffset.UtcNow,
 17477            leaseDuration ?? DefaultLeaseDuration,
 17478            maxCount);
 79    }
 80}