You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Model/Tasks/ITaskManager.cs

108 lines
3.7 KiB

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