aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application/ISharedFileCache.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-08-05 09:46:33 -0500
committerGitHub <noreply@github.com>2021-08-05 09:46:33 -0500
commitadca7674d78c73ef2f2bd505bd4652460794826c (patch)
treee1a8812a3797b36846b5e00c53e478b938989dc2 /src/slskd/Application/ISharedFileCache.cs
parentfdded3572f465c2ddc3110c0927711537215fd58 (diff)
parentd33a280c2307925aa68102beaa2e61a38f8e7e6c (diff)
downloadslskd-adca7674d78c73ef2f2bd505bd4652460794826c.tar.gz
Merge pull request #140 from slskd/share-hash
Make shared file cache fill asynchronous, enable re-scanning shares at runtime via API
Diffstat (limited to 'src/slskd/Application/ISharedFileCache.cs')
-rw-r--r--src/slskd/Application/ISharedFileCache.cs31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/slskd/Application/ISharedFileCache.cs b/src/slskd/Application/ISharedFileCache.cs
index 97133e40..291d78e4 100644
--- a/src/slskd/Application/ISharedFileCache.cs
+++ b/src/slskd/Application/ISharedFileCache.cs
@@ -17,20 +17,37 @@
namespace slskd
{
- using System;
using System.Collections.Generic;
+ using System.Threading.Tasks;
using Soulseek;
+ /// <summary>
+ /// Shared file cache.
+ /// </summary>
public interface ISharedFileCache
{
- event EventHandler<(int Directories, int Files)> Refreshed;
+ /// <summary>
+ /// Gets the cache state.
+ /// </summary>
+ IStateMonitor<SharedFileCacheState> State { get; }
- IEnumerable<string> Directories { get; }
- DateTime? LastFill { get; }
- long TTL { get; }
+ /// <summary>
+ /// Returns the contents of the cache.
+ /// </summary>
+ /// <returns>The contents of the cache.</returns>
+ IEnumerable<Directory> Browse();
- void Fill();
+ /// <summary>
+ /// Scans the configured shares and fills the cache.
+ /// </summary>
+ /// <returns>The operation context.</returns>
+ Task FillAsync();
- IEnumerable<File> Search(SearchQuery query);
+ /// <summary>
+ /// Searches the cache for the specified <paramref name="query"/> and returns the matching files.
+ /// </summary>
+ /// <param name="query">The query for which to search.</param>
+ /// <returns>The matching files.</returns>
+ Task<IEnumerable<File>> SearchAsync(SearchQuery query);
}
} \ No newline at end of file