Ejemplo n.º 1
0
        public async Task Start(string[] arguments)
        {
            Settings = new MemstateSettings(arguments);
            Settings.WithRandomSuffixAppendedToStreamName();
            Settings.LoggerFactory.AddConsole((category, level) => level > LogLevel.Debug);

            Logger = Settings.CreateLogger <Benchmark>();

            Engine = new EngineBuilder(Settings).Build <KeyValueStore <int> >();

            var totals = new List <TimeSpan>(Runs);

            for (var run = 0; run < Runs; run++)
            {
                Logger.LogInformation($"Run {run + 1}");

                var stopwatch = Stopwatch.StartNew();

                await Run();

                stopwatch.Stop();

                totals.Add(stopwatch.Elapsed);

                await Total(stopwatch.Elapsed);
            }

            await Engine.DisposeAsync();

            await Totals(totals);

            Done?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 2
0
        public PostgresqlProvider(MemstateSettings settings)
        {
            _log      = settings.CreateLogger <PostgresqlProvider>();
            _settings = settings;

            Settings = new PostgresqlSettings(settings);
        }
Ejemplo n.º 3
0
 public EventStoreReader(MemstateSettings config, EventStoreSettings eventStoreSettings, IEventStoreConnection connection)
 {
     _logger         = config.CreateLogger <EventStoreReader>();
     _connection     = connection;
     _serializer     = config.Serializers.Create(eventStoreSettings.Serializer, config);
     _streamName     = eventStoreSettings.StreamName;
     _eventsPerSlice = eventStoreSettings.EventsPerSlice;
 }
Ejemplo n.º 4
0
 public PostgresqlJournalWriter(MemstateSettings settings)
     : base(settings)
 {
     Ensure.NotNull(settings, nameof(settings));
     _serializer = settings.CreateSerializer();
     _settings   = new PostgresqlSettings(settings);
     _logger     = settings.CreateLogger <PostgresqlJournalWriter>();
 }
Ejemplo n.º 5
0
        public EventStoreSubscriptionSource(MemstateSettings settings, IEventStoreConnection connection)
        {
            _logger           = settings.CreateLogger <EventStoreSubscriptionSource>();
            _memstateSettings = settings;
            _connection       = connection;
            var eventStoreSettings = new EventStoreSettings(settings);

            _serializer = eventStoreSettings.CreateSerializer();
            _streamName = eventStoreSettings.StreamName;
        }
Ejemplo n.º 6
0
        public EventStoreWriter(MemstateSettings settings, IEventStoreConnection connection)
            : base(settings)
        {
            _connection = connection;
            _logger     = settings.CreateLogger <EventStoreWriter>();
            var eventStoreSettings = new EventStoreSettings(settings);

            _serializer = eventStoreSettings.CreateSerializer();
            _streamName = eventStoreSettings.StreamName;
        }
        public EventStoreConnectionMonitor(MemstateSettings config, IEventStoreConnection connection)
        {
            ILogger logger         = config.CreateLogger <EventStoreConnectionMonitor>();
            string  connectionName = connection.ConnectionName;

            connection.Closed        += (s, e) => logger.LogInformation("ES connection {0} closed, reason: {1}", connectionName, e.Reason);
            connection.Disconnected  += (s, e) => logger.LogWarning("ES disconnected, {0}", connectionName);
            connection.ErrorOccurred += (s, e) => logger.LogError("ES connection {0} error: ", default(EventId), e.Exception, connectionName);
            connection.Reconnecting  += (s, e) => logger.LogInformation("ES {0} reconnecting", connectionName);
            connection.Connected     += (s, e) => logger.LogInformation("ES {0} connected", connectionName);
        }
 public EventStoreSubscriptionAdapter(MemstateSettings config, EventStoreCatchUpSubscription subscription, Func <bool> ready)
 {
     _logger       = config.CreateLogger <EventStoreSubscriptionAdapter>();
     _subscription = subscription;
     _ready        = ready;
 }