IScheduledTaskWorker.cs 2.4 KB

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