feat: Add MongoIdempotencyStoreOptions for MongoDB configuration
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
feat: Implement BsonJsonConverter for converting BsonDocument and BsonArray to JSON fix: Update project file to include MongoDB.Bson package test: Add GraphOverlayExporterTests to validate NDJSON export functionality refactor: Refactor Program.cs in Attestation Tool for improved argument parsing and error handling docs: Update README for stella-forensic-verify with usage instructions and exit codes feat: Enhance HmacVerifier with clock skew and not-after checks feat: Add MerkleRootVerifier and ChainOfCustodyVerifier for additional verification methods fix: Update DenoRuntimeShim to correctly handle file paths feat: Introduce ComposerAutoloadData and related parsing in ComposerLockReader test: Add tests for Deno runtime execution and verification test: Enhance PHP package tests to include autoload data verification test: Add unit tests for HmacVerifier and verification logic
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace StellaOps.Graph.Indexer.Incremental;
|
||||
|
||||
@@ -25,4 +27,54 @@ public static class GraphChangeStreamServiceCollectionExtensions
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user