sprints work.
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
namespace StellaOps.BinaryIndex.GroundTruth.Debuginfod.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration options for the debuginfod connector.
|
||||
/// </summary>
|
||||
public sealed class DebuginfodOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Section name for configuration binding.
|
||||
/// </summary>
|
||||
public const string SectionName = "GroundTruth:Debuginfod";
|
||||
|
||||
/// <summary>
|
||||
/// HTTP client name for DI.
|
||||
/// </summary>
|
||||
public const string HttpClientName = "debuginfod";
|
||||
|
||||
/// <summary>
|
||||
/// Base URL for the debuginfod service.
|
||||
/// Defaults to Fedora's public debuginfod service.
|
||||
/// </summary>
|
||||
public Uri BaseUrl { get; set; } = new("https://debuginfod.fedoraproject.org");
|
||||
|
||||
/// <summary>
|
||||
/// Additional debuginfod URLs to query (for fallback or multiple sources).
|
||||
/// </summary>
|
||||
public List<Uri> AdditionalUrls { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Request timeout in seconds.
|
||||
/// </summary>
|
||||
public int TimeoutSeconds { get; set; } = 30;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum concurrent requests.
|
||||
/// </summary>
|
||||
public int MaxConcurrentRequests { get; set; } = 4;
|
||||
|
||||
/// <summary>
|
||||
/// Retry count for failed requests.
|
||||
/// </summary>
|
||||
public int RetryCount { get; set; } = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Initial retry delay in milliseconds.
|
||||
/// </summary>
|
||||
public int RetryDelayMs { get; set; } = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to verify IMA signatures when available.
|
||||
/// </summary>
|
||||
public bool VerifyImaSignatures { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Local cache directory for downloaded debuginfo.
|
||||
/// </summary>
|
||||
public string? CacheDirectory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum cache size in megabytes.
|
||||
/// </summary>
|
||||
public int MaxCacheSizeMb { get; set; } = 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Cache expiration in hours.
|
||||
/// </summary>
|
||||
public int CacheExpirationHours { get; set; } = 168; // 1 week
|
||||
|
||||
/// <summary>
|
||||
/// User agent string.
|
||||
/// </summary>
|
||||
public string UserAgent { get; set; } = "StellaOps.GroundTruth.Debuginfod/1.0";
|
||||
|
||||
/// <summary>
|
||||
/// Whether to include source files in fetch.
|
||||
/// </summary>
|
||||
public bool IncludeSourceFiles { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Validate options.
|
||||
/// </summary>
|
||||
public void Validate()
|
||||
{
|
||||
if (BaseUrl is null)
|
||||
throw new InvalidOperationException("Debuginfod base URL must be configured.");
|
||||
|
||||
if (!BaseUrl.IsAbsoluteUri)
|
||||
throw new InvalidOperationException("Debuginfod base URL must be an absolute URI.");
|
||||
|
||||
if (TimeoutSeconds <= 0)
|
||||
throw new InvalidOperationException("Timeout must be positive.");
|
||||
|
||||
if (MaxConcurrentRequests <= 0)
|
||||
throw new InvalidOperationException("Max concurrent requests must be positive.");
|
||||
|
||||
if (RetryCount < 0)
|
||||
throw new InvalidOperationException("Retry count cannot be negative.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user