47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using StellaOps.Concelier.Core.Jobs;
|
|
|
|
namespace StellaOps.Concelier.Connector.Distro.Suse;
|
|
|
|
internal static class SuseJobKinds
|
|
{
|
|
public const string Fetch = "source:suse:fetch";
|
|
public const string Parse = "source:suse:parse";
|
|
public const string Map = "source:suse:map";
|
|
}
|
|
|
|
internal sealed class SuseFetchJob : IJob
|
|
{
|
|
private readonly SuseConnector _connector;
|
|
|
|
public SuseFetchJob(SuseConnector connector)
|
|
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
|
|
|
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
|
=> _connector.FetchAsync(context.Services, cancellationToken);
|
|
}
|
|
|
|
internal sealed class SuseParseJob : IJob
|
|
{
|
|
private readonly SuseConnector _connector;
|
|
|
|
public SuseParseJob(SuseConnector connector)
|
|
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
|
|
|
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
|
=> _connector.ParseAsync(context.Services, cancellationToken);
|
|
}
|
|
|
|
internal sealed class SuseMapJob : IJob
|
|
{
|
|
private readonly SuseConnector _connector;
|
|
|
|
public SuseMapJob(SuseConnector connector)
|
|
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
|
|
|
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
|
=> _connector.MapAsync(context.Services, cancellationToken);
|
|
}
|