Exemplo n.º 1
0
        public override async Task TestFixtureSetUp()
        {
            await base.TestFixtureSetUp();

            var indexDirectory = GetFilePathFor("index");

            _logFormat = LogFormatHelper <TLogFormat, TStreamId> .LogFormatFactory.Create(new() {
                IndexDirectory = indexDirectory,
            });

            var dbConfig         = TFChunkHelper.CreateSizedDbConfig(PathName, 0, chunkSize: 1024 * 1024);
            var dbCreationHelper = new TFChunkDbCreationHelper <TLogFormat, TStreamId>(dbConfig, _logFormat);

            _dbResult = dbCreationHelper
                        .Chunk().CompleteLastChunk()
                        .Chunk().CompleteLastChunk()
                        .Chunk()
                        .CreateDb();

            _dbResult.Db.Config.WriterCheckpoint.Flush();
            _dbResult.Db.Config.ChaserCheckpoint.Write(_dbResult.Db.Config.WriterCheckpoint.Read());
            _dbResult.Db.Config.ChaserCheckpoint.Flush();

            Log              = new FakeTFScavengerLog();
            FakeTableIndex   = new FakeTableIndex <TStreamId>();
            TfChunkScavenger = new TFChunkScavenger <TStreamId>(_dbResult.Db, Log, FakeTableIndex, new FakeReadIndex <TLogFormat, TStreamId>(_ => false, _logFormat.Metastreams),
                                                                _logFormat.Metastreams);

            try {
                await When().WithTimeout(TimeSpan.FromMinutes(1));
            } catch (Exception ex) {
                throw new Exception("When Failed", ex);
            }
        }
        public override async Task TestFixtureSetUp()
        {
            await base.TestFixtureSetUp();

            var dbConfig         = TFChunkHelper.CreateSizedDbConfig(PathName, 0, chunkSize: 1024 * 1024);
            var dbCreationHelper = new TFChunkDbCreationHelper(dbConfig);

            _dbResult = dbCreationHelper
                        .Chunk().CompleteLastChunk()
                        .Chunk().CompleteLastChunk()
                        .Chunk()
                        .CreateDb();

            _dbResult.Db.Config.WriterCheckpoint.Flush();
            _dbResult.Db.Config.ChaserCheckpoint.Write(_dbResult.Db.Config.WriterCheckpoint.Read());
            _dbResult.Db.Config.ChaserCheckpoint.Flush();

            Log              = new FakeTFScavengerLog();
            FakeTableIndex   = new FakeTableIndex();
            TfChunkScavenger = new TFChunkScavenger(_dbResult.Db, Log, FakeTableIndex, new FakeReadIndex(_ => false));

            try {
                await When().WithTimeout(TimeSpan.FromMinutes(1));
            } catch (Exception ex) {
                throw new Exception("When Failed", ex);
            }
        }
Exemplo n.º 3
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var dbConfig         = TFChunkHelper.CreateDbConfig(PathName, 0, chunkSize: 1024 * 1024);
            var dbCreationHelper = new TFChunkDbCreationHelper(dbConfig);

            _dbResult = dbCreationHelper
                        .Chunk().CompleteLastChunk()
                        .Chunk().CompleteLastChunk()
                        .Chunk()
                        .CreateDb();

            _dbResult.Db.Config.WriterCheckpoint.Flush();
            _dbResult.Db.Config.ChaserCheckpoint.Write(_dbResult.Db.Config.WriterCheckpoint.Read());
            _dbResult.Db.Config.ChaserCheckpoint.Flush();

            Log = new FakeTFScavengerLog();
            TfChunkScavenger = new TFChunkScavenger(_dbResult.Db, Log, new FakeTableIndex(), new FakeReadIndex(_ => false));

            When();
        }