up
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

This commit is contained in:
StellaOps Bot
2025-12-12 09:35:37 +02:00
parent ce5ec9c158
commit efaf3cb789
238 changed files with 146274 additions and 5767 deletions

View File

@@ -1,8 +1,7 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using StellaOps.Graph.Indexer.Ingestion.Sbom;
namespace StellaOps.Graph.Indexer.Incremental;
@@ -23,58 +22,12 @@ public static class GraphChangeStreamServiceCollectionExtensions
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;
}
public static IServiceCollection AddGraphChangeStreamProcessorWithMongo(
this IServiceCollection services,
Action<GraphChangeStreamOptions>? configureOptions = null,
Action<MongoGraphChangeEventOptions>? configureChangeOptions = null,
Action<MongoIdempotencyStoreOptions>? configureIdempotency = null)
{
services.AddGraphChangeStreamProcessor(configureOptions);
if (configureChangeOptions is not null)
{
services.Configure(configureChangeOptions);
}
else
{
services.Configure<MongoGraphChangeEventOptions>(_ => { });
}
if (configureIdempotency is not null)
{
services.Configure(configureIdempotency);
}
else
{
services.Configure<MongoIdempotencyStoreOptions>(_ => { });
}
services.Replace(ServiceDescriptor.Singleton<IGraphChangeEventSource>(sp =>
{
var db = sp.GetRequiredService<IMongoDatabase>();
var opts = sp.GetRequiredService<IOptions<MongoGraphChangeEventOptions>>();
return new MongoGraphChangeEventSource(db, opts.Value);
}));
services.Replace(ServiceDescriptor.Singleton<IGraphBackfillSource>(sp =>
{
var db = sp.GetRequiredService<IMongoDatabase>();
var opts = sp.GetRequiredService<IOptions<MongoGraphChangeEventOptions>>();
return new MongoGraphChangeEventSource(db, opts.Value);
}));
services.Replace(ServiceDescriptor.Singleton<IIdempotencyStore>(sp =>
{
var db = sp.GetRequiredService<IMongoDatabase>();
var opts = sp.GetRequiredService<IOptions<MongoIdempotencyStoreOptions>>();
return new MongoIdempotencyStore(db, opts.Value);
}));
return services;
}
}