wabbajack/Wabbajack.RateLimiter/IResource.cs

22 lines
618 B
C#
Raw Permalink Normal View History

using System.Collections.Generic;
2021-09-27 12:42:46 +00:00
using System.Threading;
using System.Threading.Tasks;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.RateLimiter;
public interface IResource
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
StatusReport StatusReport { get; }
string Name { get; }
int MaxTasks { get; set; }
long MaxThroughput { get; set; }
IEnumerable<IJob> Jobs { get; }
2021-10-23 16:51:17 +00:00
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public interface IResource<T> : IResource
{
public ValueTask<Job<T>> Begin(string jobTitle, long size, CancellationToken token);
ValueTask Report(Job<T> job, int processedSize, CancellationToken token);
void ReportNoWait(Job<T> job, int processedSize);
void Finish(Job<T> job);
2021-09-27 12:42:46 +00:00
}