up
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using StellaOps.Scanner.Cache.Abstractions;
|
||||
using StellaOps.Scanner.Surface.Env;
|
||||
|
||||
namespace StellaOps.Scanner.Reachability;
|
||||
|
||||
public interface IReachabilityUnionPublisherService
|
||||
{
|
||||
Task<ReachabilityUnionPublishResult> PublishAsync(ReachabilityUnionGraph graph, string analysisId, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default service that writes a union graph to CAS using the worker surface cache root.
|
||||
/// </summary>
|
||||
public sealed class ReachabilityUnionPublisherService : IReachabilityUnionPublisherService
|
||||
{
|
||||
private readonly ISurfaceEnvironment environment;
|
||||
private readonly IFileContentAddressableStore cas;
|
||||
private readonly ReachabilityUnionPublisher publisher;
|
||||
|
||||
public ReachabilityUnionPublisherService(
|
||||
ISurfaceEnvironment environment,
|
||||
IFileContentAddressableStore cas,
|
||||
ReachabilityUnionPublisher publisher)
|
||||
{
|
||||
this.environment = environment ?? throw new ArgumentNullException(nameof(environment));
|
||||
this.cas = cas ?? throw new ArgumentNullException(nameof(cas));
|
||||
this.publisher = publisher ?? throw new ArgumentNullException(nameof(publisher));
|
||||
}
|
||||
|
||||
public Task<ReachabilityUnionPublishResult> PublishAsync(ReachabilityUnionGraph graph, string analysisId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var workRoot = Path.Combine(environment.Settings.CacheRoot.FullName, "reachability");
|
||||
Directory.CreateDirectory(workRoot);
|
||||
return publisher.PublishAsync(graph, cas, workRoot, analysisId, cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user