Exemplo n.º 1
0
        public async Task <IStreamStore> GetStreamStore(string schema)
        {
            var settings = new PostgresStreamStoreSettings(ConnectionString)
            {
                Schema    = schema,
                GetUtcNow = () => GetUtcNow()
            };
            var store = new PostgresStreamStore(settings);

            return(store);
        }
Exemplo n.º 2
0
        public Task <IStreamStore> GetStreamStore(string schema)
        {
            var settings = new PostgresStreamStoreSettings(ConnectionString)
            {
                Schema    = schema,
                GetUtcNow = () => GetUtcNow()
            };
            IStreamStore store = new PostgresStreamStore(settings);

            return(Task.FromResult(store));
        }
        public async Task <PostgresStreamStore> GetUninitializedPostgresStreamStore(bool scavengeAsynchronously = false)
        {
            await CreateDatabase();

            var settings = new PostgresStreamStoreSettings(ConnectionString)
            {
                Schema    = _schema,
                GetUtcNow = () => GetUtcNow(),
                ScavengeAsynchronously = scavengeAsynchronously
            };

            return(new PostgresStreamStore(settings));
        }
Exemplo n.º 4
0
        public override async Task <IStreamStore> GetStreamStore()
        {
            await CreateDatabase();

            var settings = new PostgresStreamStoreSettings(ConnectionString)
            {
                Schema    = _schema,
                GetUtcNow = () => GetUtcNow()
            };
            var store = new PostgresStreamStore(settings);
            await store.DropAll(ignoreErrors : true);

            return(store);
        }
        public async Task <IStreamStore> GetStreamStore(string schema)
        {
            await CreateDatabase();

            var settings = new PostgresStreamStoreSettings(ConnectionString)
            {
                Schema    = schema,
                GetUtcNow = () => GetUtcNow()
            };
            var store = new PostgresStreamStore(settings);

            await store.CreateSchema();

            return(store);
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Initializes a new instance of <see cref="PostgresStreamStore"/>
        /// </summary>
        /// <param name="settings">A settings class to configure this instance.</param>
        public PostgresStreamStore(PostgresStreamStoreSettings settings)
            : base(settings.GetUtcNow, settings.LogName)
        {
            _settings            = settings;
            _createConnection    = () => _settings.ConnectionFactory(_settings.ConnectionString);
            _streamStoreNotifier = new Lazy <IStreamStoreNotifier>(() =>
            {
                if (_settings.CreateStreamStoreNotifier == null)
                {
                    throw new InvalidOperationException(
                        "Cannot create notifier because supplied createStreamStoreNotifier was null");
                }

                return(settings.CreateStreamStoreNotifier.Invoke(this));
            });
            _schema = new Schema(_settings.Schema);
        }
Exemplo n.º 7
0
 private PostgresStreamStoreFixture(
     string schema,
     ITestOutputHelper testOutputHelper,
     bool createSchema)
 {
     _schema          = schema;
     _createSchema    = createSchema;
     _databaseManager = new PostgresDockerDatabaseManager(
         testOutputHelper,
         $"test_{Guid.NewGuid():n}");
     _settings = new PostgresStreamStoreSettings(ConnectionString)
     {
         Schema    = _schema,
         GetUtcNow = () => GetUtcNow(),
         ScavengeAsynchronously = false
     };
 }
        public override async Task <IStreamStore> GetStreamStore()
        {
            await CreateDatabase();

            var settings = new PostgresStreamStoreSettings(ConnectionString)
            {
                Schema    = _schema,
                GetUtcNow = () => GetUtcNow(),
                ScavengeAsynchronously = false
            };

            var store = new PostgresStreamStore(settings);

            await store.CreateSchema();

            return(store);
        }
Exemplo n.º 9
0
        private async Task Init()
        {
            await _databaseManager.CreateDatabase();

            var settings = new PostgresStreamStoreSettings(ConnectionString)
            {
                Schema    = _schema,
                GetUtcNow = () => GetUtcNow(),
                ScavengeAsynchronously = false
            };

            Store = new PostgresStreamStore(settings);

            if (_createSchema)
            {
                await Store.CreateSchemaIfNotExists();
            }
        }
        public PostgresStreamStoreFixture(
            string schema,
            PostgresDockerDatabaseManager dockerInstance,
            string databaseName,
            Action onDispose)
        {
            _onDispose = onDispose;

            DatabaseName = databaseName;
            var connectionString = dockerInstance.ConnectionString;

            _settings = new PostgresStreamStoreSettings(connectionString)
            {
                Schema    = schema,
                GetUtcNow = () => GetUtcNow(),
                DisableDeletionTracking = false,
                ScavengeAsynchronously  = false,
            };
        }
Exemplo n.º 11
0
 public PostgresStreamStore(PostgresStreamStoreSettings settings)
     : base(settings.MetadataMaxAgeCacheExpire, settings.MetadataMaxAgeCacheMaxSize, settings.GetUtcNow, settings.LogName)
 {
     this._settings = settings;
 }