IScheduledTask.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using MediaBrowser.Common.Kernel;
  2. using MediaBrowser.Model.Tasks;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Common.ScheduledTasks
  7. {
  8. /// <summary>
  9. /// Interface IScheduledTask
  10. /// </summary>
  11. public interface IScheduledTask : IDisposable
  12. {
  13. /// <summary>
  14. /// Gets the triggers.
  15. /// </summary>
  16. /// <value>The triggers.</value>
  17. IEnumerable<BaseTaskTrigger> Triggers { get; set; }
  18. /// <summary>
  19. /// Gets the last execution result.
  20. /// </summary>
  21. /// <value>The last execution result.</value>
  22. TaskResult LastExecutionResult { get; }
  23. /// <summary>
  24. /// Gets the state.
  25. /// </summary>
  26. /// <value>The state.</value>
  27. TaskState State { get; }
  28. /// <summary>
  29. /// Gets the current progress.
  30. /// </summary>
  31. /// <value>The current progress.</value>
  32. TaskProgress CurrentProgress { get; }
  33. /// <summary>
  34. /// Gets the name of the task
  35. /// </summary>
  36. /// <value>The name.</value>
  37. string Name { get; }
  38. /// <summary>
  39. /// Gets the description.
  40. /// </summary>
  41. /// <value>The description.</value>
  42. string Description { get; }
  43. /// <summary>
  44. /// Gets the category.
  45. /// </summary>
  46. /// <value>The category.</value>
  47. string Category { get; }
  48. /// <summary>
  49. /// Gets the unique id.
  50. /// </summary>
  51. /// <value>The unique id.</value>
  52. Guid Id { get; }
  53. /// <summary>
  54. /// Executes the task
  55. /// </summary>
  56. /// <returns>Task.</returns>
  57. /// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception>
  58. Task Execute();
  59. /// <summary>
  60. /// Stops the task if it is currently executing
  61. /// </summary>
  62. /// <exception cref="System.InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
  63. void Cancel();
  64. /// <summary>
  65. /// Initializes the specified kernel.
  66. /// </summary>
  67. /// <param name="kernel">The kernel.</param>
  68. void Initialize(IKernel kernel);
  69. /// <summary>
  70. /// Cancels if running.
  71. /// </summary>
  72. void CancelIfRunning();
  73. }
  74. }