Initial commit (history squashed)
This commit is contained in:
43
src/StellaOps.Feedser.Source.Ghsa/Jobs.cs
Normal file
43
src/StellaOps.Feedser.Source.Ghsa/Jobs.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using StellaOps.Feedser.Core.Jobs;
|
||||
|
||||
namespace StellaOps.Feedser.Source.Ghsa;
|
||||
|
||||
internal static class GhsaJobKinds
|
||||
{
|
||||
public const string Fetch = "source:ghsa:fetch";
|
||||
public const string Parse = "source:ghsa:parse";
|
||||
public const string Map = "source:ghsa:map";
|
||||
}
|
||||
|
||||
internal sealed class GhsaFetchJob : IJob
|
||||
{
|
||||
private readonly GhsaConnector _connector;
|
||||
|
||||
public GhsaFetchJob(GhsaConnector connector)
|
||||
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
||||
|
||||
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
||||
=> _connector.FetchAsync(context.Services, cancellationToken);
|
||||
}
|
||||
|
||||
internal sealed class GhsaParseJob : IJob
|
||||
{
|
||||
private readonly GhsaConnector _connector;
|
||||
|
||||
public GhsaParseJob(GhsaConnector connector)
|
||||
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
||||
|
||||
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
||||
=> _connector.ParseAsync(context.Services, cancellationToken);
|
||||
}
|
||||
|
||||
internal sealed class GhsaMapJob : IJob
|
||||
{
|
||||
private readonly GhsaConnector _connector;
|
||||
|
||||
public GhsaMapJob(GhsaConnector connector)
|
||||
=> _connector = connector ?? throw new ArgumentNullException(nameof(connector));
|
||||
|
||||
public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
|
||||
=> _connector.MapAsync(context.Services, cancellationToken);
|
||||
}
|
||||
Reference in New Issue
Block a user