aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Shares/IShareService.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-12-26 20:58:22 -0600
committerJP Dillingham <jp@dillingham.me>2023-12-26 20:58:22 -0600
commite0453b237211da8a116d9b9dce24eae5f43d20f9 (patch)
tree40140a0d9540c7172f0b395c2f698e81656d07f9 /src/slskd/Shares/IShareService.cs
parentb55d2dcb2d4e04553a34a1044fd85f0ab579b786 (diff)
downloadslskd-e0453b237211da8a116d9b9dce24eae5f43d20f9.tar.gz
add ListScansAsync
Diffstat (limited to 'src/slskd/Shares/IShareService.cs')
-rw-r--r--src/slskd/Shares/IShareService.cs53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/slskd/Shares/IShareService.cs b/src/slskd/Shares/IShareService.cs
index aea3240a..957b0639 100644
--- a/src/slskd/Shares/IShareService.cs
+++ b/src/slskd/Shares/IShareService.cs
@@ -17,7 +17,9 @@
namespace slskd.Shares
{
+ using System;
using System.Collections.Generic;
+ using System.Linq.Expressions;
using System.Threading.Tasks;
using Soulseek;
@@ -61,12 +63,11 @@ namespace slskd.Shares
Task DumpAsync(string filename);
/// <summary>
- /// Returns the share host with the specified <paramref name="name"/>.
+ /// Initializes the service and shares.
/// </summary>
- /// <param name="name">The name of the host.</param>
- /// <param name="host">The host, if found.</param>
- /// <returns>A value indicating whether the host was found.</returns>
- bool TryGetHost(string name, out Host host);
+ /// <param name="forceRescan">A value indicating whether a full re-scan of shares should be performed.</param>
+ /// <returns>The operation context.</returns>
+ Task InitializeAsync(bool forceRescan = false);
/// <summary>
/// Returns the contents of the specified <paramref name="directory"/>.
@@ -76,11 +77,16 @@ namespace slskd.Shares
Task<Directory> ListDirectoryAsync(string directory);
/// <summary>
- /// Removes the share host with the specified <paramref name="name"/>.
+ /// Returns the list of all <see cref="Scan"/> records matching the specified <paramref name="predicate"/>.
/// </summary>
- /// <param name="name">The name of the host.</param>
- /// <returns>A value indicating whether the host was removed.</returns>
- bool TryRemoveHost(string name);
+ /// <param name="predicate">An optional expression used to locate scans.</param>
+ /// <returns>The operation context, including the list of found scans.</returns>
+ Task<IEnumerable<Scan>> ListScansAsync(Expression<Func<Scan, bool>> predicate = null);
+
+ /// <summary>
+ /// Requests that a share scan is performed.
+ /// </summary>
+ void RequestScan();
/// <summary>
/// Resolves the local filename of the specified <paramref name="remoteFilename"/>, if the mask is associated with a
@@ -94,9 +100,11 @@ namespace slskd.Shares
Task<(string Host, string Filename)> ResolveFileAsync(string remoteFilename);
/// <summary>
- /// Requests that a share scan is performed.
+ /// Scans the configured shares on the local host.
/// </summary>
- void RequestScan();
+ /// <returns>The operation context.</returns>
+ /// <exception cref="ShareScanInProgressException">Thrown when a scan is already in progress.</exception>
+ Task ScanAsync();
/// <summary>
/// Searches the cache for the specified <paramref name="query"/> and returns the matching files.
@@ -106,23 +114,24 @@ namespace slskd.Shares
Task<IEnumerable<File>> SearchAsync(SearchQuery query);
/// <summary>
- /// Scans the configured shares on the local host.
- /// </summary>
- /// <returns>The operation context.</returns>
- /// <exception cref="ShareScanInProgressException">Thrown when a scan is already in progress.</exception>
- Task ScanAsync();
-
- /// <summary>
/// Cancels the currently running scan on the local host, if one is running.
/// </summary>
/// <returns>A value indicating whether a scan was cancelled.</returns>
bool TryCancelScan();
/// <summary>
- /// Initializes the service and shares.
+ /// Returns the share host with the specified <paramref name="name"/>.
/// </summary>
- /// <param name="forceRescan">A value indicating whether a full re-scan of shares should be performed.</param>
- /// <returns>The operation context.</returns>
- Task InitializeAsync(bool forceRescan = false);
+ /// <param name="name">The name of the host.</param>
+ /// <param name="host">The host, if found.</param>
+ /// <returns>A value indicating whether the host was found.</returns>
+ bool TryGetHost(string name, out Host host);
+
+ /// <summary>
+ /// Removes the share host with the specified <paramref name="name"/>.
+ /// </summary>
+ /// <param name="name">The name of the host.</param>
+ /// <returns>A value indicating whether the host was removed.</returns>
+ bool TryRemoveHost(string name);
}
} \ No newline at end of file