diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-09-19 12:38:28 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-09-19 12:38:28 -0500 |
| commit | d7d4b34c8aa560c847c9e4c4a14de65a8826b923 (patch) | |
| tree | d1254a496ac2f2c67deb257f5a752e663b8f8c67 /src/slskd/Application/SharedFileCache.cs | |
| parent | f30ff919a6ca1b2c7ee195d0d5ecbd6594c6df2e (diff) | |
| download | slskd-d7d4b34c8aa560c847c9e4c4a14de65a8826b923.tar.gz | |
consolidate some interfaces and classes
Diffstat (limited to 'src/slskd/Application/SharedFileCache.cs')
| -rw-r--r-- | src/slskd/Application/SharedFileCache.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/SharedFileCache.cs index e1f3e96d..71d1bae1 100644 --- a/src/slskd/Application/SharedFileCache.cs +++ b/src/slskd/Application/SharedFileCache.cs @@ -35,6 +35,51 @@ namespace slskd /// <summary> /// Shared file cache. /// </summary> + public interface ISharedFileCache + { + /// <summary> + /// Gets the cache state monitor. + /// </summary> + IStateMonitor<SharedFileCacheState> StateMonitor { get; } + + /// <summary> + /// Returns the contents of the cache. + /// </summary> + /// <returns>The contents of the cache.</returns> + IEnumerable<Directory> Browse(); + + /// <summary> + /// Scans the configured shares and fills the cache. + /// </summary> + /// <returns>The operation context.</returns> + Task FillAsync(); + + /// <summary> + /// Returns the contents of the specified <paramref name="directory"/>. + /// </summary> + /// <param name="directory">The directory for which the contents are to be listed.</param> + /// <returns>The contents of the directory.</returns> + Directory List(string directory); + + /// <summary> + /// Substitutes the mask in the specified <paramref name="filename"/> with the original path, if the mask is tracked + /// by the cache. + /// </summary> + /// <param name="filename">The fully qualified filename to unmask.</param> + /// <returns>The unmasked filename.</returns> + public string Resolve(string filename); + + /// <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); + } + + /// <summary> + /// Shared file cache. + /// </summary> public class SharedFileCache : ISharedFileCache { /// <summary> |
