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


C# HashListMemTable类代码示例

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


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

示例1: TestFixtureSetUp

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

            _mergeFile = GetTempFilePath();
            _filename = GetTempFilePath();

            _map = IndexMap.FromFile(_filename, maxTablesPerLevel: 4);
            var memtable = new HashListMemTable(maxSize: 10);
            memtable.Add(0, 1, 0);

            _result = _map.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 1, 2,
                                     _ => true, new GuidFilenameProvider(PathName));
            _result.ToDelete.ForEach(x => x.MarkForDestruction());

            _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 3, 4,
                                                  _ => true, new GuidFilenameProvider(PathName));
            _result.ToDelete.ForEach(x => x.MarkForDestruction());

            _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 4, 5,
                                                  _ => true, new GuidFilenameProvider(PathName));
            _result.ToDelete.ForEach(x => x.MarkForDestruction());

            _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 1,
                                                  _ => true, new FakeFilenameProvider(_mergeFile));
            _result.ToDelete.ForEach(x => x.MarkForDestruction());
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:27,代码来源:adding_four_items_to_empty_index_map_with_four_tables_per_level_causes_merge.cs

示例2: TestFixtureSetUp

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

            _mergeFile = GetTempFilePath();
            _filename = GetTempFilePath();

            _map = IndexMap.FromFile(_filename, maxTablesPerLevel: 4);
            var memtable = new HashListMemTable(_ptableVersion, maxSize: 10);
            memtable.Add(0, 1, 0);

            _result = _map.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 1, 2,
                                     (streamId, hash) => hash,
                                     _ => true, _ => new System.Tuple<string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion);
            _result.ToDelete.ForEach(x => x.MarkForDestruction());

            _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 3, 4,
                                                 (streamId, hash) => hash,
                                                  _ => true, _ => new System.Tuple<string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion);
            _result.ToDelete.ForEach(x => x.MarkForDestruction());

            _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 4, 5,
                                                 (streamId, hash) => hash,
                                                  _ => true, _ => new System.Tuple<string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion);
            _result.ToDelete.ForEach(x => x.MarkForDestruction());

            _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 1,
                                                 (streamId, hash) => hash,
                                                  _ => true, _ => new System.Tuple<string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion);
            _result.ToDelete.ForEach(x => x.MarkForDestruction());
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:31,代码来源:adding_four_items_to_empty_index_map_with_four_tables_per_level_causes_merge.cs

示例3: SetUp

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

            _filename = GetFilePathFor("indexfile");
            _tablename = GetTempFilePath();
            _mergeFile = GetFilePathFor("outfile");

            _map = IndexMap.FromFile(_filename, maxTablesPerLevel: 4);
            var memtable = new HashListMemTable(maxSize: 10);
            memtable.Add(0, 2, 123);
            var table = PTable.FromMemtable(memtable, _tablename);
            _result = _map.AddPTable(table, 0, 0, _ => true, new FakeFilenameProvider(_mergeFile));
            _result = _result.MergedMap.AddPTable(table, 0, 0, _ => true, new FakeFilenameProvider(_mergeFile));
            _result = _result.MergedMap.AddPTable(table, 0, 0, _ => true, new FakeFilenameProvider(_mergeFile));
            var merged = _result.MergedMap.AddPTable(table, 0, 0, _ => true, new FakeFilenameProvider(_mergeFile));
            _result = merged.MergedMap.AddPTable(table, 0, 0, _ => true, new FakeFilenameProvider(_mergeFile));
            _result = _result.MergedMap.AddPTable(table, 7, 11, _ => true, new FakeFilenameProvider(_mergeFile));
            _result.MergedMap.SaveToFile(_filename);

            table.Dispose();
        
            merged.MergedMap.InOrder().ToList().ForEach(x => x.Dispose());
            merged.ToDelete.ForEach(x => x.Dispose());

            _result.MergedMap.InOrder().ToList().ForEach(x => x.Dispose());
            _result.ToDelete.ForEach(x => x.Dispose());
        }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:28,代码来源:saving_index_with_six_items_to_a_file.cs

示例4: TestFixtureSetUp

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

            var table = new HashListMemTable(maxSize: 2000);
            table.Add(0x0101, 0x0001, 0x0001);
            _ptable = PTable.FromMemtable(table, Filename, cacheDepth: 0);
        }
开发者ID:robashton,项目名称:EventStore,代码行数:8,代码来源:ptable_should.cs

示例5: wait_for_destroy_will_timeout

 public void wait_for_destroy_will_timeout()
 {
     var tmp = Path.GetRandomFileName();
     var table = new HashListMemTable();
     table.Add(0x0101, 0x0001, 0x0001);
     var stable = PTable.FromMemtable(table, tmp);
     Assert.Throws<TimeoutException>(() => stable.WaitForDestroy(1));
 }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:8,代码来源:when_creating_ptable_from_memtable.cs

示例6: Setup

 public void Setup()
 {
     var mtable = new HashListMemTable(maxSize: 10);
     mtable.Add(0x0101, 0x0001, 0x0001);
     mtable.Add(0x0105, 0x0001, 0x0002);
     _table = PTable.FromMemtable(mtable, Filename);
     _table.MarkForDestruction();
 }
开发者ID:Kristinn-Stefansson,项目名称:EventStore,代码行数:8,代码来源:destroying_ptable.cs

示例7: Setup

 public void Setup()
 {
     _filename = Path.GetRandomFileName();
     var mtable = new HashListMemTable();
     mtable.Add(0x0101, 0x0001, 0x0001);
     mtable.Add(0x0105, 0x0001, 0x0002);
     _table = PTable.FromMemtable(mtable, _filename);
     _table.MarkForDestruction();
 }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:9,代码来源:destroying_ptable.cs

示例8: Setup

        public void Setup()
        {
            _filename = Path.GetRandomFileName();
            var table = new HashListMemTable();

            AddItemsForScenario(table);

            PTable = PTable.FromMemtable(table, _filename, cacheDepth: _midpointCacheDepth);
        }
开发者ID:jpierson,项目名称:EventStore,代码行数:9,代码来源:PTableReadScenario.cs

示例9: the_hash_of_file_is_valid

 public void the_hash_of_file_is_valid()
 {
     var table = new HashListMemTable(_ptableVersion, maxSize: 10);
     table.Add(0x010100000000, 0x0001, 0x0001);
     table.Add(0x010500000000, 0x0001, 0x0002);
     table.Add(0x010200000000, 0x0001, 0x0003);
     table.Add(0x010200000000, 0x0002, 0x0003);
     Assert.DoesNotThrow(() => {using (var sstable = PTable.FromMemtable(table, Filename)) {}});
 }
开发者ID:EventStore,项目名称:EventStore,代码行数:9,代码来源:when_creating_ptable_from_memtable.cs

示例10: SetUp

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

            var table = new HashListMemTable(maxSize: 50);

            AddItemsForScenario(table);

            PTable = PTable.FromMemtable(table, Filename, cacheDepth: _midpointCacheDepth);
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:10,代码来源:PTableReadScenario.cs

示例11: nothing_is_found_on_empty_stream

 public void nothing_is_found_on_empty_stream()
 {
     var memTable = new HashListMemTable(_ptableVersion, maxSize: 10);
     memTable.Add(0x010100000000, 0x01, 0xffff);
     using (var ptable = PTable.FromMemtable(memTable, Filename))
     {
         IndexEntry entry;
         Assert.IsFalse(ptable.TryGetLatestEntry(0x12, out entry));
     }
 }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:10,代码来源:when_trying_to_get_latest_entry.cs

示例12: ConstructPTable

        private PTable ConstructPTable(string file, int count, Random rnd)
        {
            var memTable = new HashListMemTable(_ptableVersion, 20000);
            for (int i = 0; i < count; ++i)
            {
                memTable.Add((uint)rnd.Next(), rnd.Next(0, 1<<20), Math.Abs(rnd.Next() * rnd.Next()));
            }

            var ptable = PTable.FromMemtable(memTable, file, 0);
            return ptable;
        }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:11,代码来源:ptable_midpoint_cache_should.cs

示例13: wait_for_destroy_will_timeout

        public void wait_for_destroy_will_timeout()
        {
            var table = new HashListMemTable(maxSize: 10);
            table.Add(0x0101, 0x0001, 0x0001);
            var ptable = PTable.FromMemtable(table, Filename);
            Assert.Throws<TimeoutException>(() => ptable.WaitForDestroy(1));

            // tear down
            ptable.MarkForDestruction();
            ptable.WaitForDestroy(1000);
        }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:11,代码来源:when_creating_ptable_from_memtable.cs

示例14: the_hash_of_file_is_valid

 public void the_hash_of_file_is_valid()
 {
     var table = new HashListMemTable(maxSize: 10);
     table.Add(0x0101, 0x0001, 0x0001);
     table.Add(0x0105, 0x0001, 0x0002);
     table.Add(0x0102, 0x0001, 0x0003);
     table.Add(0x0102, 0x0002, 0x0003);
     using (var sstable = PTable.FromMemtable(table, Filename))
     {
         Assert.DoesNotThrow(() => sstable.VerifyFileHash());
     }
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:12,代码来源:when_creating_ptable_from_memtable.cs

示例15: SetUp

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

            _indexMapFileName = GetFilePathFor("index.map");
            _ptableFileName = GetFilePathFor("ptable");

            _emptyIndexMap = IndexMap.FromFile(_indexMapFileName, _ptableVersion);

            var memTable = new HashListMemTable(_ptableVersion, maxSize: 10);
            memTable.Add(0, 1, 2);
            _ptable = PTable.FromMemtable(memTable, _ptableFileName, _ptableVersion);
        }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:13,代码来源:index_map_should.cs


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