ITaskManager.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Threading.Tasks;
  5. using Jellyfin.Data.Events;
  6. namespace MediaBrowser.Model.Tasks
  7. {
  8. public interface ITaskManager : IDisposable
  9. {
  10. /// <summary>
  11. /// Gets the list of Scheduled Tasks.
  12. /// </summary>
  13. /// <value>The scheduled tasks.</value>
  14. IScheduledTaskWorker[] ScheduledTasks { get; }
  15. /// <summary>
  16. /// Cancels if running and queue.
  17. /// </summary>
  18. /// <typeparam name="T"></typeparam>
  19. /// <param name="options">Task options.</param>
  20. void CancelIfRunningAndQueue<T>(TaskOptions options)
  21. where T : IScheduledTask;
  22. /// <summary>
  23. /// Cancels if running and queue.
  24. /// </summary>
  25. /// <typeparam name="T"></typeparam>
  26. void CancelIfRunningAndQueue<T>()
  27. where T : IScheduledTask;
  28. /// <summary>
  29. /// Cancels if running.
  30. /// </summary>
  31. /// <typeparam name="T"></typeparam>
  32. void CancelIfRunning<T>()
  33. where T : IScheduledTask;
  34. /// <summary>
  35. /// Queues the scheduled task.
  36. /// </summary>
  37. /// <typeparam name="T"></typeparam>
  38. /// <param name="options">Task options.</param>
  39. void QueueScheduledTask<T>(TaskOptions options)
  40. where T : IScheduledTask;
  41. /// <summary>
  42. /// Queues the scheduled task.
  43. /// </summary>
  44. /// <typeparam name="T"></typeparam>
  45. void QueueScheduledTask<T>()
  46. where T : IScheduledTask;
  47. void QueueIfNotRunning<T>()
  48. where T : IScheduledTask;
  49. /// <summary>
  50. /// Queues the scheduled task.
  51. /// </summary>
  52. void QueueScheduledTask(IScheduledTask task, TaskOptions options);
  53. /// <summary>
  54. /// Adds the tasks.
  55. /// </summary>
  56. /// <param name="tasks">The tasks.</param>
  57. void AddTasks(IEnumerable<IScheduledTask> tasks);
  58. void Cancel(IScheduledTaskWorker task);
  59. Task Execute(IScheduledTaskWorker task, TaskOptions options);
  60. void Execute<T>()
  61. where T : IScheduledTask;
  62. event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting;
  63. event EventHandler<TaskCompletionEventArgs> TaskCompleted;
  64. }
  65. }