2022-04-11 18:00:34 +05:00
|
|
|
|
using System;
|
2022-02-17 15:37:27 +05:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudApp.Services
|
|
|
|
|
{
|
|
|
|
|
public interface IBackgroundWorkerService
|
|
|
|
|
{
|
|
|
|
|
bool Contains(string id);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Добавляет в очередь задач новую задачу
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">id задачи в очереди</param>
|
|
|
|
|
/// <param name="func">делегат</param>
|
|
|
|
|
/// <returns>id задачи в очереди</returns>
|
|
|
|
|
string Enqueue(string id, Func<string, CancellationToken, Task> func);
|
|
|
|
|
string Enqueue(Func<string, CancellationToken, Task> func);
|
|
|
|
|
string Enqueue(string id, Func<string, CancellationToken, Task> func, Func<string, Exception, CancellationToken, Task> onError);
|
|
|
|
|
bool TryRemove(string id);
|
|
|
|
|
}
|
|
|
|
|
}
|