aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-05-30 16:11:06 -0500
committerJP Dillingham <jpdillingham@gmail.com>2022-05-30 16:11:06 -0500
commit41897719b57ac3b64a1a9f2f78982e6c9b6dc868 (patch)
treee953f66e1cb9bdff591a2f4a6836b4a3d318682e /src
parenta95df84e99b5b447da44955901dd6d0ad1816de6 (diff)
downloadslskd-41897719b57ac3b64a1a9f2f78982e6c9b6dc868.tar.gz
split/finalize IShareService
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Shares/IShareService.cs77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/slskd/Shares/IShareService.cs b/src/slskd/Shares/IShareService.cs
new file mode 100644
index 00000000..cc91ba07
--- /dev/null
+++ b/src/slskd/Shares/IShareService.cs
@@ -0,0 +1,77 @@
+// <copyright file="IShareService.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.Shares
+{
+ using System.Collections.Generic;
+ using System.Threading.Tasks;
+ using Soulseek;
+
+ /// <summary>
+ /// Provides control and interactions with configured shares and shared files.
+ /// </summary>
+ public interface IShareService
+ {
+ /// <summary>
+ /// Gets the list of configured shares.
+ /// </summary>
+ IReadOnlyList<Share> Shares { get; }
+
+ /// <summary>
+ /// Gets the state monitor for the service.
+ /// </summary>
+ public IStateMonitor<ShareState> StateMonitor { get; }
+
+ /// <summary>
+ /// Returns the entire contents of the share.
+ /// </summary>
+ /// <returns>The entire contents of the share.</returns>
+ Task<IEnumerable<Directory>> BrowseAsync();
+
+ /// <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>
+ Task<Directory> ListAsync(string directory);
+
+ /// <summary>
+ /// Resolves the local filename of the specified <paramref name="remoteFilename"/>, if the mask is associated with a
+ /// configured share.
+ /// </summary>
+ /// <param name="remoteFilename">The fully qualified filename to resolve.</param>
+ /// <returns>The resolved local filename.</returns>
+ /// <exception cref="NotFoundException">
+ /// Thrown when the specified remote filename can not be associated with a configured share.
+ /// </exception>
+ Task<string> ResolveAsync(string remoteFilename);
+
+ /// <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>
+ /// Starts a scan of the configured shares.
+ /// </summary>
+ /// <returns>The operation context.</returns>
+ /// <exception cref="ShareScanInProgressException">Thrown when a scan is already in progress.</exception>
+ Task StartScanAsync();
+ }
+}