• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Chunks.TFChunkDbConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EventStore.Core.TransactionLog.Chunks.TFChunkDbConfig的典型用法代码示例。如果您正苦于以下问题:C# TFChunkDbConfig类的具体用法?C# TFChunkDbConfig怎么用?C# TFChunkDbConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TFChunkDbConfig类属于EventStore.Core.TransactionLog.Chunks命名空间,在下文中一共展示了TFChunkDbConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TFChunkDb

        public TFChunkDb(TFChunkDbConfig config)
        {
            Ensure.NotNull(config, "config");

            Config = config;
            Manager = new TFChunkManager(Config);
        }
开发者ID:riccardone,项目名称:EventStore,代码行数:7,代码来源:TFChunkDb.cs


示例2: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            _config = new TFChunkDbConfig(PathName,
                                          new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                          1000,
                                          0,
                                          new InMemoryCheckpoint(1711),
                                          new InMemoryCheckpoint(5500),
                                          new InMemoryCheckpoint(5500),
                                          new InMemoryCheckpoint(1111));

            var rnd = new Random();
            _file1Contents = new byte[_config.ChunkSize];
            _file2Contents = new byte[_config.ChunkSize];
            rnd.NextBytes(_file1Contents);
            rnd.NextBytes(_file2Contents);

            DbUtil.CreateSingleChunk(_config, 0, GetFilePathFor("chunk-000000.000001"), contents:_file1Contents);
            DbUtil.CreateSingleChunk(_config, 1, GetFilePathFor("chunk-000001.000002"), contents: _file2Contents);

            var truncator = new TFChunkDbTruncator(_config);
            truncator.TruncateDb(_config.TruncateCheckpoint.ReadNonFlushed());
        }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:25,代码来源:when_truncating_into_the_middle_of_completed_chunk.cs


示例3: TFChunkDbCreationHelper

        public TFChunkDbCreationHelper(TFChunkDbConfig dbConfig)
        {
            Ensure.NotNull(dbConfig, "dbConfig");
            _dbConfig = dbConfig;

            _db = new TFChunkDb(_dbConfig);
            _db.OpenVerifyAndClean();

            if (_db.Config.WriterCheckpoint.ReadNonFlushed() > 0)
                throw new Exception("The DB already contains some data.");
        }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:11,代码来源:TFChunkDbCreationHelper.cs


示例4: a_null_checkpoint_throws_argument_null_exception

 public void a_null_checkpoint_throws_argument_null_exception()
 {
     var config = new TFChunkDbConfig(Path.GetTempPath(),
                                      new PrefixFileNamingStrategy(Path.GetTempPath(), "prefix.tf"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(0),
                                      new ICheckpoint[0]);
     var db = new TFChunkDb(config);
     Assert.Throws<ArgumentNullException>(() => new TFChunkReader(db, null));
 }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:11,代码来源:when_creating_chunked_transaction_file_reader.cs


示例5: allows_first_correct_file_when_checkpoint_is_zero

 public void allows_first_correct_file_when_checkpoint_is_zero()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new PrefixFileNamingStrategy(PathName, "prefix.tf"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(),
                                      new ICheckpoint[0]);
     var db = new TFChunkDb(config);
     CreateChunk(Path.Combine(PathName, config.FileNamingStrategy.GetFilenameFor(0)), config.ChunkSize, config.ChunkSize);
     Assert.DoesNotThrow(() => db.OpenVerifyAndClean(verifyHash: false));
     db.Dispose();
 }
开发者ID:soto,项目名称:EventStore,代码行数:13,代码来源:when_validating_chunked_transaction_db.cs


示例6: a_null_checkpoint_throws_argument_null_exception

 public void a_null_checkpoint_throws_argument_null_exception()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(0),
                                      new InMemoryCheckpoint(0),
                                      new InMemoryCheckpoint(-1),
                                      new InMemoryCheckpoint(-1));
     var db = new TFChunkDb(config);
     Assert.Throws<ArgumentNullException>(() => new TFChunkReader(db, null));
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:13,代码来源:when_creating_chunked_transaction_file_reader.cs


示例7: allows_next_new_chunk_when_checksum_is_exactly_in_between_two_chunks

 public void allows_next_new_chunk_when_checksum_is_exactly_in_between_two_chunks()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new PrefixFileNamingStrategy(PathName, "prefix.tf"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(10000),
                                      new ICheckpoint[0]);
     var db = new TFChunkDb(config);
     CreateChunk(Path.Combine(PathName, config.FileNamingStrategy.GetFilenameFor(0)), config.ChunkSize, config.ChunkSize);
     CreateChunk(Path.Combine(PathName, config.FileNamingStrategy.GetFilenameFor(1)), config.ChunkSize, config.ChunkSize);
     Assert.DoesNotThrow(() => db.OpenVerifyAndClean(verifyHash: false));
     db.Dispose();
 }
开发者ID:soto,项目名称:EventStore,代码行数:14,代码来源:when_validating_chunked_transaction_db.cs


示例8: with_file_of_wrong_size_database_corruption_is_detected

 public void with_file_of_wrong_size_database_corruption_is_detected()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new PrefixFileNamingStrategy(PathName, "prefix.tf"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(500),
                                      new ICheckpoint[0]);
     var db = new TFChunkDb(config);
     File.WriteAllText(Path.Combine(PathName, config.FileNamingStrategy.GetFilenameFor(0)), "this is just some test blahbydy blah");
     var ex = Assert.Throws<CorruptDatabaseException>(db.OpenVerifyAndClean);
     Assert.IsInstanceOf<BadChunkInDatabaseException>(ex.InnerException);
     db.Dispose();
 }
开发者ID:jpierson,项目名称:EventStore,代码行数:14,代码来源:when_validating_chunked_transaction_db.cs


示例9: with_wrong_actual_chunk_size_in_chunk_footer

 public void with_wrong_actual_chunk_size_in_chunk_footer()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new PrefixFileNamingStrategy(PathName, "prefix.tf"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(10000),
                                      new ICheckpoint[0]);
     var db = new TFChunkDb(config);
     CreateChunk(Path.Combine(PathName, config.FileNamingStrategy.GetFilenameFor(0)), 10000, 12000);
     var ex = Assert.Throws<CorruptDatabaseException>(db.OpenVerifyAndClean);
     Assert.IsInstanceOf<BadChunkInDatabaseException>(ex.InnerException);
     db.Dispose();
 }
开发者ID:jpierson,项目名称:EventStore,代码行数:14,代码来源:when_validating_chunked_transaction_db.cs


示例10: with_not_enough_files_to_reach_checksum_throws

 public void with_not_enough_files_to_reach_checksum_throws()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new PrefixFileNamingStrategy(PathName, "prefix.tf"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(15000),
                                      new ICheckpoint[0]);
     var db = new TFChunkDb(config);
     CreateChunk(Path.Combine(PathName, config.FileNamingStrategy.GetFilenameFor(0)), config.ChunkSize, config.ChunkSize);
     var exc = Assert.Throws<CorruptDatabaseException>(db.OpenVerifyAndClean);
     Assert.IsInstanceOf<ChunkNotFoundException>(exc.InnerException);
     db.Dispose();
 }
开发者ID:jpierson,项目名称:EventStore,代码行数:14,代码来源:when_validating_chunked_transaction_db.cs


示例11: CreateMultiChunk

        public static void CreateMultiChunk(TFChunkDbConfig config, int chunkStartNum, int chunkEndNum, string filename,
                                            int? physicalSize = null, long? logicalSize = null)
        {
            if (chunkStartNum > chunkEndNum) throw new ArgumentException("chunkStartNum");

            var chunkHeader = new ChunkHeader(TFChunk.CurrentChunkVersion, config.ChunkSize, chunkStartNum, chunkEndNum, true, Guid.NewGuid());
            var chunkBytes = chunkHeader.AsByteArray();
            var physicalDataSize = physicalSize ?? config.ChunkSize;
            var logicalDataSize = logicalSize ?? (chunkEndNum - chunkStartNum + 1) * config.ChunkSize;
            var buf = new byte[ChunkHeader.Size + physicalDataSize + ChunkFooter.Size];
            Buffer.BlockCopy(chunkBytes, 0, buf, 0, chunkBytes.Length);
            var chunkFooter = new ChunkFooter(true, true, physicalDataSize, logicalDataSize, 0, new byte[ChunkFooter.ChecksumSize]);
            chunkBytes = chunkFooter.AsByteArray();
            Buffer.BlockCopy(chunkBytes, 0, buf, buf.Length - ChunkFooter.Size, chunkBytes.Length);
            File.WriteAllBytes(filename, buf);
        }
开发者ID:czcz1024,项目名称:EventStore,代码行数:16,代码来源:TFChunkDbCreationTestBase.cs


示例12: allows_with_exactly_enough_file_to_reach_checksum

 public void allows_with_exactly_enough_file_to_reach_checksum()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(10000),
                                      new InMemoryCheckpoint(),
                                      new InMemoryCheckpoint(-1),
                                      new InMemoryCheckpoint(-1));
     using (var db = new TFChunkDb(config))
     {
         DbUtil.CreateSingleChunk(config, 0, GetFilePathFor("chunk-000000.000000"));
         Assert.DoesNotThrow(() => db.Open(verifyHash: false));
     }
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:16,代码来源:when_validating_tfchunk_db.cs


示例13: CreateOngoingChunk

        public static void CreateOngoingChunk(TFChunkDbConfig config, int chunkNum, string filename, int? actualSize = null, byte[] contents = null)
        {
            var chunkHeader = new ChunkHeader(TFChunk.CurrentChunkVersion, config.ChunkSize, chunkNum, chunkNum, false, Guid.NewGuid());
            var chunkBytes = chunkHeader.AsByteArray();
            var dataSize = actualSize ?? config.ChunkSize;
            var buf = new byte[ChunkHeader.Size + dataSize + ChunkFooter.Size];
            Buffer.BlockCopy(chunkBytes, 0, buf, 0, chunkBytes.Length);

            if (contents != null)
            {
                if (contents.Length != dataSize)
                    throw new Exception("Wrong contents size.");
                Buffer.BlockCopy(contents, 0, buf, ChunkHeader.Size, contents.Length);
            }

            File.WriteAllBytes(filename, buf);
        }        
开发者ID:czcz1024,项目名称:EventStore,代码行数:17,代码来源:TFChunkDbCreationTestBase.cs


示例14: with_a_writer_checksum_of_zero_the_first_chunk_is_created_with_correct_name

        public void with_a_writer_checksum_of_zero_the_first_chunk_is_created_with_correct_name()
        {
            var config = new TFChunkDbConfig(PathName,
                                             new PrefixFileNamingStrategy(PathName, "prefix.tf"),
                                             10000,
                                             0,
                                             new InMemoryCheckpoint(0),
                                             new ICheckpoint[0]);
            var db = new TFChunkDb(config);
            db.OpenVerifyAndClean();
            db.Dispose();

            Assert.AreEqual(1, Directory.GetFiles(PathName).Length);
            Assert.IsTrue(File.Exists(Path.Combine(PathName, "prefix.tf0")));
            var fileInfo = new FileInfo(Path.Combine(PathName, "prefix.tf0"));
            Assert.AreEqual(10000 + ChunkHeader.Size + ChunkFooter.Size, fileInfo.Length);
        }
开发者ID:jpierson,项目名称:EventStore,代码行数:17,代码来源:when_opening_chunked_transaction_file_db_without_previous_files.cs


示例15: with_file_of_wrong_size_database_corruption_is_detected

 public void with_file_of_wrong_size_database_corruption_is_detected()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(500),
                                      new InMemoryCheckpoint(),
                                      new InMemoryCheckpoint(-1),
                                      new InMemoryCheckpoint(-1));
     using (var db = new TFChunkDb(config))
     {
         File.WriteAllText(GetFilePathFor("chunk-000000.000000"), "this is just some test blahbydy blah");
         Assert.That(() => db.Open(verifyHash: false),
                     Throws.Exception.InstanceOf<CorruptDatabaseException>()
                     .With.InnerException.InstanceOf<BadChunkInDatabaseException>());
     }
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:18,代码来源:when_validating_tfchunk_db.cs


示例16: with_checksum_inside_multi_chunk_throws

 public void with_checksum_inside_multi_chunk_throws()
 {
     var config = new TFChunkDbConfig(PathName,
                                      new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                      10000,
                                      0,
                                      new InMemoryCheckpoint(25000),
                                      new InMemoryCheckpoint(),
                                      new InMemoryCheckpoint(-1),
                                      new InMemoryCheckpoint(-1));
     using (var db = new TFChunkDb(config))
     {
         DbUtil.CreateMultiChunk(config, 0, 2, GetFilePathFor("chunk-000000.000000"));
         Assert.That(() => db.Open(verifyHash: false),
                     Throws.Exception.InstanceOf<CorruptDatabaseException>()
                     .With.InnerException.InstanceOf<ChunkNotFoundException>());
     }
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:18,代码来源:when_validating_tfchunk_db_with_multi_chunks.cs


示例17: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var dbConfig = new TFChunkDbConfig(PathName,
                                               new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                               1024*1024,
                                               0,
                                               new InMemoryCheckpoint(0),
                                               new InMemoryCheckpoint(0));
            var dbCreationHelper = new TFChunkDbCreationHelper(dbConfig);
            _dbResult = CreateDb(dbCreationHelper);
            _keptRecords = KeptRecords(_dbResult);

            var scavengeReadIndex = new ScavengeReadIndex(_dbResult.Streams);
            var scavenger = new TFChunkScavenger(_dbResult.Db, scavengeReadIndex);
            scavenger.Scavenge(alwaysKeepScavenged: true);
        }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:18,代码来源:ScavengeTestScenario.cs


示例18: with_a_writer_checksum_of_zero_the_first_chunk_is_created_with_correct_name

        public void with_a_writer_checksum_of_zero_the_first_chunk_is_created_with_correct_name()
        {
            var config = new TFChunkDbConfig(PathName,
                                             new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                             10000,
                                             0,
                                             new InMemoryCheckpoint(0),
                                             new InMemoryCheckpoint(0),
                                             new InMemoryCheckpoint(-1),
                                             new InMemoryCheckpoint(-1));
            var db = new TFChunkDb(config);
            db.Open();
            db.Dispose();

            Assert.AreEqual(1, Directory.GetFiles(PathName).Length);
            Assert.IsTrue(File.Exists(GetFilePathFor("chunk-000000.000000")));
            var fileInfo = new FileInfo(GetFilePathFor("chunk-000000.000000"));
            Assert.AreEqual(10000 + ChunkHeader.Size + ChunkFooter.Size, fileInfo.Length);
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:19,代码来源:when_opening_chunked_transaction_file_db_without_previous_files.cs


示例19: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var dbConfig = new TFChunkDbConfig(PathName,
                                               new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                               1024*1024,
                                               0,
                                               new InMemoryCheckpoint(0),
                                               new InMemoryCheckpoint(0),
                                               new InMemoryCheckpoint(-1),
                                               new InMemoryCheckpoint(-1));
            var dbCreationHelper = new TFChunkDbCreationHelper(dbConfig);
            _dbResult = CreateDb(dbCreationHelper);
            _keptRecords = KeptRecords(_dbResult);

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

            var indexPath = Path.Combine(PathName, "index");
            var readerPool = new ObjectPool<ITransactionFileReader>(
                "ReadIndex readers pool", ESConsts.PTableInitialReaderCount, ESConsts.PTableMaxReaderCount,
                () => new TFChunkReader(_dbResult.Db, _dbResult.Db.Config.WriterCheckpoint));
            var lowHasher = new XXHashUnsafe();
            var highHasher = new Murmur3AUnsafe();
            var tableIndex = new TableIndex(indexPath, lowHasher, highHasher,
                                            () => new HashListMemTable(PTableVersions.Index64Bit, maxSize: 200),
                                            () => new TFReaderLease(readerPool),
                                            PTableVersions.Index64Bit,
                                            maxSizeForMemory: 100,
                                            maxTablesPerLevel: 2);
            ReadIndex = new ReadIndex(new NoopPublisher(), readerPool, tableIndex, 100, true, _metastreamMaxCount, Opts.HashCollisionReadLimitDefault);
            ReadIndex.Init(_dbResult.Db.Config.WriterCheckpoint.Read());

            //var scavengeReadIndex = new ScavengeReadIndex(_dbResult.Streams, _metastreamMaxCount);
            var bus = new InMemoryBus("Bus");
            var ioDispatcher = new IODispatcher(bus, new PublishEnvelope(bus));
            var scavenger = new TFChunkScavenger(_dbResult.Db, ioDispatcher, tableIndex, ReadIndex, Guid.NewGuid(), "fakeNodeIp",
                                            unsafeIgnoreHardDeletes: UnsafeIgnoreHardDelete());
            scavenger.Scavenge(alwaysKeepScavenged: true, mergeChunks: false);
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:42,代码来源:ScavengeTestScenario.cs


示例20: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var dbConfig = new TFChunkDbConfig(PathName,
                                               new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                               1024*1024,
                                               0,
                                               new InMemoryCheckpoint(0),
                                               new InMemoryCheckpoint(0),
                                               new InMemoryCheckpoint(-1),
                                               new InMemoryCheckpoint(-1));
            var dbCreationHelper = new TFChunkDbCreationHelper(dbConfig);
            
            DbRes = CreateDb(dbCreationHelper);

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

            var readers = new ObjectPool<ITransactionFileReader>(
                "Readers", 2, 2, () => new TFChunkReader(DbRes.Db, DbRes.Db.Config.WriterCheckpoint));

            var lowHasher = new XXHashUnsafe();
            var highHasher = new Murmur3AUnsafe();
            TableIndex = new TableIndex(GetFilePathFor("index"), lowHasher, highHasher,
                                        () => new HashListMemTable(PTableVersions.Index64Bit, MaxEntriesInMemTable * 2),
                                        () => new TFReaderLease(readers),
                                        PTableVersions.Index64Bit,
                                        MaxEntriesInMemTable);

            ReadIndex = new ReadIndex(new NoopPublisher(),
                                      readers,
                                      TableIndex,
                                      0,
                                      additionalCommitChecks: true,
                                      metastreamMaxCount: _metastreamMaxCount,
                                      hashCollisionReadLimit: Opts.HashCollisionReadLimitDefault);

            ReadIndex.Init(DbRes.Db.Config.ChaserCheckpoint.Read());
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:41,代码来源:SimpleDbTestScenario.cs



注:本文中的EventStore.Core.TransactionLog.Chunks.TFChunkDbConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Processing.EmittedEventEnvelope类代码示例发布时间:2022-05-24
下一篇:
C# Chunks.TFChunkDb类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap