aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-10-15 15:39:28 -0500
committerGitHub <noreply@github.com>2023-10-15 15:39:28 -0500
commitf2c0f7658a95e4c6425eb455ef4d19f64fb841d8 (patch)
tree46630f3e0ffb8ed6c5289dc37946ae5bf47b662e /src
parent5986bcadc179e3e9a34152687b80210dcc65e366 (diff)
parentbd8fe8eb32dc6550d23bd2840b37797e7fc70c48 (diff)
downloadslskd-f2c0f7658a95e4c6425eb455ef4d19f64fb841d8.tar.gz
Merge pull request #980 from slskd/retention
Move transfer retention options
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs12
-rw-r--r--src/slskd/Core/Options.cs76
2 files changed, 50 insertions, 38 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 6d6ccd37..89ff6b27 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -821,13 +821,13 @@ namespace slskd
try
{
- PruneUpload(options.Upload.Succeeded, TransferStates.Succeeded);
- PruneUpload(options.Upload.Cancelled, TransferStates.Cancelled);
- PruneUpload(options.Upload.Errored, TransferStates.Errored);
+ PruneUpload(options.Transfers.Upload.Succeeded, TransferStates.Succeeded);
+ PruneUpload(options.Transfers.Upload.Cancelled, TransferStates.Cancelled);
+ PruneUpload(options.Transfers.Upload.Errored, TransferStates.Errored);
- PruneDownload(options.Download.Succeeded, TransferStates.Succeeded);
- PruneDownload(options.Download.Cancelled, TransferStates.Cancelled);
- PruneDownload(options.Download.Errored, TransferStates.Errored);
+ PruneDownload(options.Transfers.Download.Succeeded, TransferStates.Succeeded);
+ PruneDownload(options.Transfers.Download.Cancelled, TransferStates.Cancelled);
+ PruneDownload(options.Transfers.Download.Errored, TransferStates.Errored);
}
catch
{
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 9d92bb95..2b9c3455 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -1060,22 +1060,16 @@ namespace slskd
public class RetentionOptions
{
/// <summary>
- /// Gets file retention options.
- /// </summary>
- [Validate]
- public FileRetentionOptions Files { get; init; } = new FileRetentionOptions();
-
- /// <summary>
- /// Gets upload retention options.
+ /// Gets transfer retention options.
/// </summary>
[Validate]
- public TransferRetentionOptions Upload { get; init; } = new TransferRetentionOptions();
+ public TransferRetentionOptions Transfers { get; init; } = new TransferRetentionOptions();
/// <summary>
- /// Gets download retention options.
+ /// Gets file retention options.
/// </summary>
[Validate]
- public TransferRetentionOptions Download { get; init; } = new TransferRetentionOptions();
+ public FileRetentionOptions Files { get; init; } = new FileRetentionOptions();
/// <summary>
/// Gets the time to retain logs, in days.
@@ -1084,45 +1078,63 @@ namespace slskd
public int Logs { get; init; } = 180;
/// <summary>
- /// File retention options.
+ /// Transfer retention options.
/// </summary>
- public class FileRetentionOptions
+ public class TransferRetentionOptions
{
/// <summary>
- /// Gets the time to retain completed files, in minutes.
+ /// Gets upload retention options.
/// </summary>
- [Range(30, maximum: int.MaxValue)]
- public int? Complete { get; init; } = null;
+ [Validate]
+ public TransferTypeRetentionOptions Upload { get; init; } = new TransferTypeRetentionOptions();
/// <summary>
- /// Gets the time to retain incomplete files, in minutes.
+ /// Gets download retention options.
/// </summary>
- [Range(30, maximum: int.MaxValue)]
- public int? Incomplete { get; init; } = null;
+ [Validate]
+ public TransferTypeRetentionOptions Download { get; init; } = new TransferTypeRetentionOptions();
+
+ /// <summary>
+ /// Transfer retention options.
+ /// </summary>
+ public class TransferTypeRetentionOptions
+ {
+ /// <summary>
+ /// Gets the time to retain successful transfers, in minutes.
+ /// </summary>
+ [Range(5, maximum: int.MaxValue)]
+ public int? Succeeded { get; init; } = null;
+
+ /// <summary>
+ /// Gets the time to retain errored transfers, in minutes.
+ /// </summary>
+ [Range(5, maximum: int.MaxValue)]
+ public int? Errored { get; init; } = null;
+
+ /// <summary>
+ /// Gets the time to retain cancelled transfers, in minutes.
+ /// </summary>
+ [Range(5, maximum: int.MaxValue)]
+ public int? Cancelled { get; init; } = null;
+ }
}
/// <summary>
- /// Transfer retention options.
+ /// File retention options.
/// </summary>
- public class TransferRetentionOptions
+ public class FileRetentionOptions
{
/// <summary>
- /// Gets the time to retain successful transfers, in minutes.
- /// </summary>
- [Range(5, maximum: int.MaxValue)]
- public int? Succeeded { get; init; } = null;
-
- /// <summary>
- /// Gets the time to retain errored transfers, in minutes.
+ /// Gets the time to retain completed files, in minutes.
/// </summary>
- [Range(5, maximum: int.MaxValue)]
- public int? Errored { get; init; } = null;
+ [Range(30, maximum: int.MaxValue)]
+ public int? Complete { get; init; } = null;
/// <summary>
- /// Gets the time to retain cancelled transfers, in minutes.
+ /// Gets the time to retain incomplete files, in minutes.
/// </summary>
- [Range(5, maximum: int.MaxValue)]
- public int? Cancelled { get; init; } = null;
+ [Range(30, maximum: int.MaxValue)]
+ public int? Incomplete { get; init; } = null;
}
}