From cf5a29422198e4defc3820edf8b160f9bcd00857 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 16 Sep 2023 22:54:16 -0500 Subject: add retention options --- src/slskd/Core/Options.cs | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 2ee21733..b2c85146 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -253,6 +253,12 @@ namespace slskd [Validate] public WebOptions Web { get; init; } = new WebOptions(); + /// + /// Gets retention options. + /// + [Validate] + public RetentionOptions Retention { get; init; } = new RetentionOptions(); + /// /// Gets logger options. /// @@ -1048,6 +1054,48 @@ namespace slskd public string Loki { get; init; } = null; } + /// + /// Retention options. + /// + public class RetentionOptions + { + /// + /// Gets upload retention options. + /// + [Validate] + public TransferRetentionOptions Upload { get; init; } = new TransferRetentionOptions(); + + /// + /// Gets download retention options. + /// + [Validate] + public TransferRetentionOptions Download { get; init; } = new TransferRetentionOptions(); + + /// + /// Transfer retention options. + /// + public class TransferRetentionOptions + { + /// + /// Gets the time to retain successful transfers, in minutes. + /// + [Range(60, maximum: int.MaxValue)] + public int Succeeded { get; init; } = int.MaxValue; + + /// + /// Gets the time to retain errored transfers, in minutes. + /// + [Range(60, maximum: int.MaxValue)] + public int Errored { get; init; } = int.MaxValue; + + /// + /// Gets the time to retain cancelled transfers, in minutes. + /// + [Range(60, maximum: int.MaxValue)] + public int Cancelled { get; init; } = int.MaxValue; + } + } + /// /// Metrics options. /// -- cgit v1.2.3