From 3920f14a70107f67831d09934861badbc1fc70cf Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 17 Sep 2023 16:01:36 -0500 Subject: consolidate I/UploadService --- src/slskd/Transfers/Uploads/IUploadService.cs | 90 --------------------------- src/slskd/Transfers/Uploads/UploadService.cs | 74 ++++++++++++++++++++++ 2 files changed, 74 insertions(+), 90 deletions(-) delete mode 100644 src/slskd/Transfers/Uploads/IUploadService.cs (limited to 'src') diff --git a/src/slskd/Transfers/Uploads/IUploadService.cs b/src/slskd/Transfers/Uploads/IUploadService.cs deleted file mode 100644 index 8fa0b194..00000000 --- a/src/slskd/Transfers/Uploads/IUploadService.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// 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/. -// - -namespace slskd.Transfers.Uploads -{ - using System; - using System.Collections.Generic; - using System.Linq.Expressions; - using System.Threading.Tasks; - - /// - /// Manages uploads. - /// - public interface IUploadService - { - /// - /// Gets the upload governor. - /// - IUploadGovernor Governor { get; } - - /// - /// Gets the upload queue. - /// - IUploadQueue Queue { get; } - - /// - /// Adds the specified . Supersedes any existing record for the same file and username. - /// - /// This should generally not be called; use instead. - /// - void AddOrSupersede(Transfer transfer); - - /// - /// Enqueues the requested file. - /// - /// The username of the requesting user. - /// The local filename of the requested file. - /// The operation context. - Task EnqueueAsync(string username, string filename); - - /// - /// Finds a single upload matching the specified . - /// - /// The expression to use to match uploads. - /// The found transfer, or default if not found. - Transfer Find(Expression> expression); - - /// - /// Returns a list of all uploads matching the optional . - /// - /// An optional expression used to match uploads. - /// Optionally include uploads that have been removed previously. - /// The list of uploads matching the specified expression, or all uploads if no expression is specified. - List List(Expression> expression = null, bool includeRemoved = false); - - /// - /// Removes the upload matching the specified . - /// - /// This is a soft delete; the record is retained for historical retrieval. - /// The unique identifier of the upload. - void Remove(Guid id); - - /// - /// Cancels the upload matching the specified , if it is in progress. - /// - /// The unique identifier for the upload. - /// A value indicating whether the upload was successfully cancelled. - bool TryCancel(Guid id); - - /// - /// Synchronously updates the specified . - /// - /// The transfer to update. - void Update(Transfer transfer); - } -} \ No newline at end of file diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs index cfbeeb8b..b9f74dac 100644 --- a/src/slskd/Transfers/Uploads/UploadService.cs +++ b/src/slskd/Transfers/Uploads/UploadService.cs @@ -34,6 +34,80 @@ namespace slskd.Transfers.Uploads using slskd.Shares; using slskd.Users; + /// + /// Manages uploads. + /// + public interface IUploadService + { + /// + /// Gets the upload governor. + /// + IUploadGovernor Governor { get; } + + /// + /// Gets the upload queue. + /// + IUploadQueue Queue { get; } + + /// + /// Adds the specified . Supersedes any existing record for the same file and username. + /// + /// This should generally not be called; use instead. + /// + void AddOrSupersede(Transfer transfer); + + /// + /// Enqueues the requested file. + /// + /// The username of the requesting user. + /// The local filename of the requested file. + /// The operation context. + Task EnqueueAsync(string username, string filename); + + /// + /// Finds a single upload matching the specified . + /// + /// The expression to use to match uploads. + /// The found transfer, or default if not found. + Transfer Find(Expression> expression); + + /// + /// Returns a list of all uploads matching the optional . + /// + /// An optional expression used to match uploads. + /// Optionally include uploads that have been removed previously. + /// The list of uploads matching the specified expression, or all uploads if no expression is specified. + List List(Expression> expression = null, bool includeRemoved = false); + + /// + /// Removes uploads older than the specified . + /// + /// The age after which uploads are eligible for pruning, in hours. + /// An optional, additional state by which uploads are filtered for pruning. + /// The number of pruned uploads. + int Prune(int age, TransferStates state = TransferStates.Completed); + + /// + /// Removes the upload matching the specified . + /// + /// This is a soft delete; the record is retained for historical retrieval. + /// The unique identifier of the upload. + void Remove(Guid id); + + /// + /// Cancels the upload matching the specified , if it is in progress. + /// + /// The unique identifier for the upload. + /// A value indicating whether the upload was successfully cancelled. + bool TryCancel(Guid id); + + /// + /// Synchronously updates the specified . + /// + /// The transfer to update. + void Update(Transfer transfer); + } + /// /// Manages uploads. /// -- cgit v1.2.3