You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1017 B
36 lines
1017 B
namespace EternalArrowBackup.TargetMetadataStorage.InMemoryMetadataStorage
|
|
{
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks.Dataflow;
|
|
using EternalArrowBackup.TargetMetadataStorage.Contracts;
|
|
|
|
internal class TargetFile : ITargetFile
|
|
{
|
|
public TargetFile(List<ITargetFileVersion> versions)
|
|
{
|
|
this.Versions = versions;
|
|
}
|
|
|
|
private List<ITargetFileVersion> Versions { get; }
|
|
|
|
public Task GetAllVersions(ActionBlock<ITargetFileVersion> actionBlock, CancellationToken ct)
|
|
{
|
|
return Task.Run(() =>
|
|
{
|
|
foreach (var version in this.Versions)
|
|
{
|
|
if (ct.IsCancellationRequested)
|
|
{
|
|
break;
|
|
}
|
|
|
|
actionBlock.Post(version);
|
|
}
|
|
|
|
actionBlock.Complete();
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|