ILimitedConcurrencyLibraryScheduler.cs 1018 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. using MediaBrowser.Model.Configuration;
  5. namespace MediaBrowser.Controller.LibraryTaskScheduler;
  6. /// <summary>
  7. /// Provides a shared scheduler to run library related tasks based on the <see cref="ServerConfiguration.LibraryScanFanoutConcurrency"/>.
  8. /// </summary>
  9. public interface ILimitedConcurrencyLibraryScheduler
  10. {
  11. /// <summary>
  12. /// Enqueues an action that will be invoked with the set data.
  13. /// </summary>
  14. /// <typeparam name="T">The data Type.</typeparam>
  15. /// <param name="data">The data.</param>
  16. /// <param name="worker">The callback to process the data.</param>
  17. /// <param name="progress">A progress reporter.</param>
  18. /// <param name="cancellationToken">Stop token.</param>
  19. /// <returns>A task that finishes when all data has been processed by the worker.</returns>
  20. Task Enqueue<T>(T[] data, Func<T, IProgress<double>, Task> worker, IProgress<double> progress, CancellationToken cancellationToken);
  21. }