< Summary

Information
Class: IceRpc.Locator.LocatorOptions
Assembly: IceRpc.Locator
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Locator/LocatorOptions.cs
Tag: 1856_27024993493
Line coverage
75%
Covered lines: 6
Uncovered lines: 2
Coverable lines: 8
Total lines: 42
Line coverage: 75%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage
85%
Covered methods: 6
Fully covered methods: 6
Total methods: 7
Method coverage: 85.7%
Full method coverage: 85.7%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Background()100%11100%
get_MaxCacheSize()100%11100%
get_RefreshThreshold()100%11100%
get_ResolveTimeout()100%11100%
set_ResolveTimeout(...)0%620%
get_Ttl()100%11100%
.ctor()100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Locator/LocatorOptions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3namespace IceRpc.Locator;
 4
 5/// <summary>A property bag used to configure a <see cref="LocatorLocationResolver" />.</summary>
 6public sealed record class LocatorOptions
 7{
 8    /// <summary>Gets or sets a value indicating whether or not the locator must enable background lookups.</summary>
 9    /// <value>When <see langword="true" />, if the lookup finds a stale cache entry, it returns the stale entry's
 10    /// server address(es) and executes a call "in the background" to refresh this entry. Defaults to <see
 11    /// langword="false" />, meaning the lookup does not return stale values.</value>
 112    public bool Background { get; set; }
 13
 14    /// <summary>Gets or sets the maximum size of the cache.</summary>
 15    /// <value>The maximum size of the cache. <c>0</c> means no cache. Defaults to <c>100</c>.</value>
 816    public int MaxCacheSize { get; set; } = 100;
 17
 18    /// <summary>Gets or sets the refresh threshold. When the age of a cache entry is less than or equal to this
 19    /// value, it's considered up to date and won't be updated even when the caller requests a refresh.</summary>
 20    /// <value>The refresh threshold. Defaults to <c>1</c> second.</value>
 821    public TimeSpan RefreshThreshold { get; set; } = TimeSpan.FromSeconds(1);
 22
 23    /// <summary>Gets or sets the timeout for locator resolution. When multiple callers concurrently request the
 24    /// same address, the locator interceptor sends a single request to the underlying locator; this timeout
 25    /// starts when that request is issued and applies to all callers.</summary>
 26    /// <value>The locator resolve timeout. Defaults to <c>10</c> seconds.</value>
 27    public TimeSpan ResolveTimeout
 28    {
 229        get => _resolveTimeout;
 030        set => _resolveTimeout = value != TimeSpan.Zero ? value :
 031            throw new ArgumentException($"0 is not a valid value for {nameof(ResolveTimeout)}", nameof(value));
 32    }
 33
 34    /// <summary>Gets or sets the time-to-live. This is the time period after which a cache entry is considered
 35    /// stale.</summary>
 36    /// <value>The time to live. Defaults to <see cref="Timeout.InfiniteTimeSpan" />, meaning the cache entries never
 37    /// become stale.
 38    /// </value>
 1339    public TimeSpan Ttl { get; set; } = Timeout.InfiniteTimeSpan;
 40
 341    private TimeSpan _resolveTimeout = TimeSpan.FromSeconds(10);
 42}