From d3009fbb67f76337949faa99cd7180d23451f8ca Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 24 Sep 2022 12:41:17 -0500 Subject: add sync/async overloads for filling, make scans cancellable --- src/slskd/Shares/ISharedFileCache.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/slskd/Shares/ISharedFileCache.cs') 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 /// /// Scans the configured shares and fills the cache. /// - /// Initiates the scan, then yields execution back to the caller; does not wait for the operation to complete. /// The list of shares from which to fill the cache. /// The list of regular expressions used to exclude files or paths from scanning. - /// The optional cancellation token to monitor. /// The operation context. - Task FillAsync(IEnumerable shares, IEnumerable filters, CancellationToken cancellationToken = default); + Task FillAsync(IEnumerable shares, IEnumerable filters); /// /// Returns the contents of the specified . @@ -62,7 +59,7 @@ namespace slskd.Shares /// /// The fully qualified filename to unmask. /// The unmasked filename. - public string Resolve(string filename); + string Resolve(string filename); /// /// Searches the cache for the specified and returns the matching files. @@ -71,10 +68,24 @@ namespace slskd.Shares /// The matching files. IEnumerable Search(SearchQuery query); + /// + /// Starts a scan of the configured shares and fills the cache. + /// + /// The list of shares from which to fill the cache. + /// The list of regular expressions used to exclude files or paths from scanning. + /// The operation context. + Task StartFillAsync(IEnumerable shares, IEnumerable filters); + + /// + /// Cancels the currently running fill operation, if one is running. + /// + /// A value indicating whether a fill operation was cancelled. + bool TryCancelFill(); + /// /// Attempts to load the cache from disk. /// /// A value indicating whether the load was successful. bool TryLoad(); } -} +} \ No newline at end of file -- cgit v1.2.3