// Copyright (C) 2025, The Duplicati Team // https://duplicati.com, hello@duplicati.com // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #nullable enable using System; using System.Threading.Tasks; namespace Duplicati.Server.Serialization.Interface; /// /// Represents a queued task. /// public interface IQueuedTask { /// /// The task ID. /// long TaskID { get; } /// /// The backup ID, if applicable. /// string? BackupID { get; } /// /// The operation type of the task. /// DuplicatiOperation Operation { get; } /// /// Callback to be executed when the task is starting. /// Func? OnStarting { get; set; } /// /// Callback to be executed when the task is finished. /// If the task completes successfully, the exception parameter will be null. /// Func? OnFinished { get; set; } /// /// Updates the throttle speeds for the task. /// /// The upload speed to set. /// The download speed to set. void UpdateThrottleSpeeds(string? uploadSpeed, string? downloadSpeed); /// /// The time when the task was starting to execute. /// DateTime? TaskStarted { get; set; } /// /// The time when the task was finished executing. /// DateTime? TaskFinished { get; set; } /// /// Stops the task. /// void Stop(); /// /// Aborts the task. /// void Abort(); /// /// Pauses the task. /// /// If true, also pauses transfers. void Pause(bool alsoTransfers); /// /// Resumes the task. /// void Resume(); }