aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/LibraryTaskScheduler/ILimitedConcurrencyLibraryScheduler.cs
blob: e7460a2e65b0dfe976c4ab9e58b00bbff5439315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Configuration;

namespace MediaBrowser.Controller.LibraryTaskScheduler;

/// <summary>
/// Provides a shared scheduler to run library related tasks based on the <see cref="ServerConfiguration.LibraryScanFanoutConcurrency"/>.
/// </summary>
public interface ILimitedConcurrencyLibraryScheduler
{
    /// <summary>
    /// Enqueues an action that will be invoked with the set data.
    /// </summary>
    /// <typeparam name="T">The data Type.</typeparam>
    /// <param name="data">The data.</param>
    /// <param name="worker">The callback to process the data.</param>
    /// <param name="progress">A progress reporter.</param>
    /// <param name="cancellationToken">Stop token.</param>
    /// <returns>A task that finishes when all data has been processed by the worker.</returns>
    Task Enqueue<T>(T[] data, Func<T, IProgress<double>, Task> worker, IProgress<double> progress, CancellationToken cancellationToken);
}