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.Ubuntu;
|
|
|
|
internal static class UbuntuJobKinds
|
|
{
|
|
public const string Fetch = "source:ubuntu:fetch";
|
|
public const string Parse = "source:ubuntu:parse";
|
|
public const string Map = "source:ubuntu:map";
|
|
}
|
|
|
|
internal sealed class UbuntuFetchJob : IJob
|
|
{
|
|
private readonly UbuntuConnector _connector;
|
|
|
|
public UbuntuFetchJob(UbuntuConnector connector)
|
|
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
|
|
|
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
|
=> _connector.FetchAsync(context.Services, cancellationToken);
|
|
}
|
|
|
|
internal sealed class UbuntuParseJob : IJob
|
|
{
|
|
private readonly UbuntuConnector _connector;
|
|
|
|
public UbuntuParseJob(UbuntuConnector connector)
|
|
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
|
|
|
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
|
=> _connector.ParseAsync(context.Services, cancellationToken);
|
|
}
|
|
|
|
internal sealed class UbuntuMapJob : IJob
|
|
{
|
|
private readonly UbuntuConnector _connector;
|
|
|
|
public UbuntuMapJob(UbuntuConnector connector)
|
|
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
|
|
|
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
|
=> _connector.MapAsync(context.Services, cancellationToken);
|
|
}
|