diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-09-24 12:41:17 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-09-24 12:41:17 -0500 |
| commit | d3009fbb67f76337949faa99cd7180d23451f8ca (patch) | |
| tree | 9f9261044a778c12bbc4a09877a816fd72538d49 /src/slskd/Shares/ISharedFileCache.cs | |
| parent | 48a4a58a2b81acca34ddf4925db16b04880eb746 (diff) | |
| download | slskd-d3009fbb67f76337949faa99cd7180d23451f8ca.tar.gz | |
add sync/async overloads for filling, make scans cancellable
Diffstat (limited to 'src/slskd/Shares/ISharedFileCache.cs')
| -rw-r--r-- | src/slskd/Shares/ISharedFileCache.cs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/slskd/Shares/ISharedFileCache.cs b/src/slskd/Shares/ISharedFileCache.cs index 52c7783c..af151353 100644 --- a/src/slskd/Shares/ISharedFileCache.cs +++ b/src/slskd/Shares/ISharedFileCache.cs @@ -19,7 +19,6 @@ namespace slskd.Shares { using System.Collections.Generic; using System.Text.RegularExpressions; - using System.Threading; using System.Threading.Tasks; using Soulseek; @@ -42,12 +41,10 @@ namespace slskd.Shares /// <summary> /// Scans the configured shares and fills the cache. /// </summary> - /// <remarks>Initiates the scan, then yields execution back to the caller; does not wait for the operation to complete.</remarks> /// <param name="shares">The list of shares from which to fill the cache.</param> /// <param name="filters">The list of regular expressions used to exclude files or paths from scanning.</param> - /// <param name="cancellationToken">The optional cancellation token to monitor.</param> /// <returns>The operation context.</returns> - Task FillAsync(IEnumerable<Share> shares, IEnumerable<Regex> filters, CancellationToken cancellationToken = default); + Task FillAsync(IEnumerable<Share> shares, IEnumerable<Regex> filters); /// <summary> /// Returns the contents of the specified <paramref name="directory"/>. @@ -62,7 +59,7 @@ namespace slskd.Shares /// </summary> /// <param name="filename">The fully qualified filename to unmask.</param> /// <returns>The unmasked filename.</returns> - public string Resolve(string filename); + string Resolve(string filename); /// <summary> /// Searches the cache for the specified <paramref name="query"/> and returns the matching files. @@ -72,9 +69,23 @@ namespace slskd.Shares IEnumerable<File> Search(SearchQuery query); /// <summary> + /// Starts a scan of the configured shares and fills the cache. + /// </summary> + /// <param name="shares">The list of shares from which to fill the cache.</param> + /// <param name="filters">The list of regular expressions used to exclude files or paths from scanning.</param> + /// <returns>The operation context.</returns> + Task StartFillAsync(IEnumerable<Share> shares, IEnumerable<Regex> filters); + + /// <summary> + /// Cancels the currently running fill operation, if one is running. + /// </summary> + /// <returns>A value indicating whether a fill operation was cancelled.</returns> + bool TryCancelFill(); + + /// <summary> /// Attempts to load the cache from disk. /// </summary> /// <returns>A value indicating whether the load was successful.</returns> bool TryLoad(); } -} +}
\ No newline at end of file |
