aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-09-19 12:38:28 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-09-19 12:38:28 -0500
commitd7d4b34c8aa560c847c9e4c4a14de65a8826b923 (patch)
treed1254a496ac2f2c67deb257f5a752e663b8f8c67 /src
parentf30ff919a6ca1b2c7ee195d0d5ecbd6594c6df2e (diff)
downloadslskd-d7d4b34c8aa560c847c9e4c4a14de65a8826b923.tar.gz
consolidate some interfaces and classes
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application/Application.cs6
-rw-r--r--src/slskd/Application/IApplication.cs28
-rw-r--r--src/slskd/Application/ISharedFileCache.cs68
-rw-r--r--src/slskd/Application/SharedFileCache.cs45
4 files changed, 51 insertions, 96 deletions
diff --git a/src/slskd/Application/Application.cs b/src/slskd/Application/Application.cs
index f167e673..32c02f64 100644
--- a/src/slskd/Application/Application.cs
+++ b/src/slskd/Application/Application.cs
@@ -39,6 +39,12 @@ namespace slskd
using Soulseek;
using Soulseek.Diagnostics;
+ public interface IApplication : IHostedService
+ {
+ public Task CheckVersionAsync();
+ public Task RescanSharesAsync();
+ }
+
public sealed class Application : IApplication
{
private static readonly int ReconnectMaxDelayMilliseconds = 300000; // 5 minutes
diff --git a/src/slskd/Application/IApplication.cs b/src/slskd/Application/IApplication.cs
deleted file mode 100644
index 18e4ad89..00000000
--- a/src/slskd/Application/IApplication.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// <copyright file="IApplication.cs" company="slskd Team">
-// Copyright (c) slskd Team. All rights reserved.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published
-// by the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see https://www.gnu.org/licenses/.
-// </copyright>
-
-namespace slskd
-{
- using System.Threading.Tasks;
- using Microsoft.Extensions.Hosting;
-
- public interface IApplication : IHostedService
- {
- public Task CheckVersionAsync();
- public Task RescanSharesAsync();
- }
-} \ No newline at end of file
diff --git a/src/slskd/Application/ISharedFileCache.cs b/src/slskd/Application/ISharedFileCache.cs
deleted file mode 100644
index 9d19d72f..00000000
--- a/src/slskd/Application/ISharedFileCache.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-// <copyright file="ISharedFileCache.cs" company="slskd Team">
-// Copyright (c) slskd Team. All rights reserved.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published
-// by the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see https://www.gnu.org/licenses/.
-// </copyright>
-
-namespace slskd
-{
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using Soulseek;
-
- /// <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);
- }
-} \ No newline at end of file
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>