Files
git.stella-ops.org/src/Graph/StellaOps.Graph.Indexer/Incremental/GraphChangeStreamServiceCollectionExtensions.cs
StellaOps Bot efaf3cb789
Some checks failed
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
up
2025-12-12 09:35:37 +02:00

34 lines
1.2 KiB
C#

using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using StellaOps.Graph.Indexer.Ingestion.Sbom;
namespace StellaOps.Graph.Indexer.Incremental;
public static class GraphChangeStreamServiceCollectionExtensions
{
public static IServiceCollection AddGraphChangeStreamProcessor(
this IServiceCollection services,
Action<GraphChangeStreamOptions>? configureOptions = null)
{
ArgumentNullException.ThrowIfNull(services);
if (configureOptions is not null)
{
services.Configure(configureOptions);
}
else
{
services.Configure<GraphChangeStreamOptions>(_ => { });
}
services.TryAddSingleton<IGraphChangeEventSource, NoOpGraphChangeEventSource>();
services.TryAddSingleton<IGraphBackfillSource, NoOpGraphChangeEventSource>();
services.TryAddSingleton<IIdempotencyStore, InMemoryIdempotencyStore>();
services.TryAddSingleton<IGraphDocumentWriter, InMemoryGraphDocumentWriter>();
services.AddSingleton<GraphBackfillMetrics>();
services.AddHostedService<GraphChangeStreamProcessor>();
return services;
}
}