using System; using System.Collections.Generic; using System.Threading.Tasks; using Jellyfin.Data.Events; namespace MediaBrowser.Model.Tasks { /// /// Interface for the TaskManager class. /// public interface ITaskManager : IDisposable { /// /// Event handler for task execution. /// event EventHandler>? TaskExecuting; /// /// Event handler for task completion. /// event EventHandler? TaskCompleted; /// /// Gets the list of Scheduled Tasks. /// /// The scheduled tasks. IReadOnlyList ScheduledTasks { get; } /// /// Cancels if running and queue. /// /// An implementation of . /// Task options. void CancelIfRunningAndQueue(TaskOptions options) where T : IScheduledTask; /// /// Cancels if running and queue. /// /// An implementation of . void CancelIfRunningAndQueue() where T : IScheduledTask; /// /// Cancels if running. /// /// An implementation of . void CancelIfRunning() where T : IScheduledTask; /// /// Queues the scheduled task. /// /// An implementation of . /// Task options. void QueueScheduledTask(TaskOptions options) where T : IScheduledTask; /// /// Queues the scheduled task. /// /// An implementation of . void QueueScheduledTask() where T : IScheduledTask; /// /// Queues the scheduled task if it is not already running. /// /// An implementation of . void QueueIfNotRunning() where T : IScheduledTask; /// /// Queues the scheduled task. /// /// The to queue. /// The to use. void QueueScheduledTask(IScheduledTask task, TaskOptions options); /// /// Adds the tasks. /// /// The tasks. void AddTasks(IEnumerable tasks); /// /// Adds the tasks. /// /// The tasks. void Cancel(IScheduledTaskWorker task); /// /// Executes the tasks. /// /// The tasks. /// The options. /// The executed tasks. Task Execute(IScheduledTaskWorker task, TaskOptions options); /// /// Executes the tasks. /// /// An implementation of . void Execute() where T : IScheduledTask; } }