当前位置: 首页>>代码示例>>C#>>正文


C# Chunks.TFChunkDbConfig类代码示例

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


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


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