Example #1
0
        public static ISiloBuilder AddSnapshotStorageBasedLogConsistencyProvider(
            this ISiloBuilder builder,
            Action <SnapshotStorageOptions, string> configureSnapshotStorageOptions,
            string name = "SnapshotStorage")
        {
            var snapshotStorageOptions = new SnapshotStorageOptions();

            configureSnapshotStorageOptions?.Invoke(snapshotStorageOptions, name);

            return(builder.ConfigureServices(services => services
                                             .AddSnapshotStorageBasedLogConsistencyProvider(snapshotStorageOptions, name)));
        }
Example #2
0
        internal static IServiceCollection AddSnapshotStorageBasedLogConsistencyProvider(
            this IServiceCollection services,
            SnapshotStorageOptions options,
            string name)
        {
            services.AddSnapshotStorageLogConsistencyOptions(options.UseIndependentEventStorage, name);

            if (options.UseIndependentEventStorage)
            {
                options.ConfigureIndependentEventStorage?.Invoke(services, name);
            }

            services
            .AddSingletonNamedService(name, (sp, n) => LogConsistencyProviderFactory.Create(sp, n, options.SnapshotStrategy))
            .TryAddSingleton(sp => sp.GetServiceByName <ILogViewAdaptorFactory>(ProviderConstants.DEFAULT_STORAGE_PROVIDER_NAME));

            return(services);
        }
        public static ISiloHostBuilder AddSnapshotStorageBasedLogConsistencyProvider(
            this ISiloHostBuilder builder,
            Action <SnapshotStorageOptions, string> configureSnapshotStorageOptions,
            string name = "SnapshotStorage")
        {
            var snapshotStorageOptions = new SnapshotStorageOptions();

            configureSnapshotStorageOptions?.Invoke(snapshotStorageOptions, name);

            return(builder.ConfigureServices(services =>
            {
                services.AddSnapshotStorageLogConsistencyOptions(snapshotStorageOptions.UseIndependentEventStorage, name);

                if (snapshotStorageOptions.UseIndependentEventStorage)
                {
                    snapshotStorageOptions.ConfigureIndependentEventStorage?.Invoke(services, name);
                }

                services.AddSnapshotStorageBasedLogConsistencyProvider(snapshotStorageOptions.SnapshotStrategy, name);
            }));
        }