aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Transfers/TransferService.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-02-07 08:08:43 -0600
committerJP Dillingham <jpdillingham@gmail.com>2022-02-07 08:08:43 -0600
commit331166bd02121faebece8a0cacfff529f2ca1b1b (patch)
tree3254f8a97c26922e42357eb958cde2bb0a80a5fe /src/slskd/Transfers/TransferService.cs
parent9fd50317dd1eea4f59764ad00aec2594c9bb48c7 (diff)
downloadslskd-331166bd02121faebece8a0cacfff529f2ca1b1b.tar.gz
split uploads out into a service
Diffstat (limited to 'src/slskd/Transfers/TransferService.cs')
-rw-r--r--src/slskd/Transfers/TransferService.cs32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/slskd/Transfers/TransferService.cs b/src/slskd/Transfers/TransferService.cs
index 952e5e38..714d85be 100644
--- a/src/slskd/Transfers/TransferService.cs
+++ b/src/slskd/Transfers/TransferService.cs
@@ -19,6 +19,7 @@ using Microsoft.Extensions.Options;
namespace slskd.Transfers
{
+ using slskd.Transfers.Uploads;
using slskd.Users;
/// <summary>
@@ -27,14 +28,9 @@ namespace slskd.Transfers
public interface ITransferService
{
/// <summary>
- /// Gets the upload governor.
+ /// Gets the upload service.
/// </summary>
- IGovernor Governor { get; }
-
- /// <summary>
- /// Gets the upload queue.
- /// </summary>
- IUploadQueue Uploads { get; }
+ IUploadService Uploads { get; }
}
/// <summary>
@@ -47,30 +43,26 @@ namespace slskd.Transfers
/// </summary>
/// <param name="userService">The UserService instance to use.</param>
/// <param name="optionsMonitor">The OptionsMonitor instance to use.</param>
- /// <param name="governor">The optional Governor instance to use.</param>
- /// <param name="uploadQueue">The optional UploadQueue instance to use.</param>
+ /// <param name="uploadService">The optional UploadService instance to use.</param>
public TransferService(
IUserService userService,
IOptionsMonitor<Options> optionsMonitor,
- IGovernor governor = null,
- IUploadQueue uploadQueue = null)
+ IUploadService uploadService = null)
{
Users = userService;
OptionsMonitor = optionsMonitor;
- Governor = governor ?? new Governor(userService: Users, optionsMonitor: OptionsMonitor);
- Uploads = uploadQueue ?? new UploadQueue(userService: Users, optionsMonitor: OptionsMonitor);
+ Uploads = uploadService ?? new UploadService()
+ {
+ Governor = new UploadGovernor(userService: Users, optionsMonitor: OptionsMonitor),
+ Queue = new UploadQueue(userService: Users, optionsMonitor: OptionsMonitor),
+ };
}
/// <summary>
- /// Gets the upload governor.
- /// </summary>
- public IGovernor Governor { get; init; }
-
- /// <summary>
- /// Gets the upload queue.
+ /// Gets the upload service.
/// </summary>
- public IUploadQueue Uploads { get; init; }
+ public IUploadService Uploads { get; init; }
private IOptionsMonitor<Options> OptionsMonitor { get; init; }
private IUserService Users { get; init; }