Пример #1
0
        public static BplusTreeBytes ReOpen(System.IO.Stream treefile, System.IO.Stream blockfile)
        {
            BplusTreeLong tree    = BplusTreeLong.SetupFromExistingStream(treefile);
            LinkedFile    archive = LinkedFile.SetupFromExistingStream(blockfile);

            return(new BplusTreeBytes(tree, archive));
        }
Пример #2
0
        private static void Process()
        {
            var stopwatch  = new System.Diagnostics.Stopwatch();
            var index      = 1;
            var batchIndex = 1;

            for (int i = 0; i < 1000000; i++)
            {
                if (index == 1)
                {
                    stopwatch.Start();
                }

                // var key = FormsAuthentication.HashPasswordForStoringInConfigFile(SmsContent + i, "MD5");
                var key = i.ToString() + "ssss";
                if (!TreeProperty.ContainsKey(key))
                {
                    try
                    {
                        TreeProperty[key] = i;
                        TreeProperty.Commit();
                    }
                    catch (Exception ex)
                    {
                        TreeProperty.Shutdown();
                        _treeProperty = null;
                        var keyFile = Path.Combine(TreeDataDir, TreeFileName);
                        if (File.Exists(keyFile))
                        {
                            File.Delete(keyFile);
                            Console.WriteLine("Delete The Bad Key File Done!");
                        }

                        TreeProperty[key] = i;
                        TreeProperty.Commit();
                    }
                }
                else
                {
                    Console.WriteLine("ContainsKey:" + key);
                }

                index++;

                if (index == StatCount)
                {
                    stopwatch.Stop();
                    var spendSeconds = stopwatch.Elapsed.TotalSeconds;
                    var speed        = StatCount / spendSeconds;
                    Console.WriteLine(batchIndex + ".Speed:" + speed.ToString("0.00") + "/s");
                    stopwatch.Reset();
                    index = 1;
                    batchIndex++;
                }
            }

            TreeProperty.Shutdown();
            Console.WriteLine("Done!");
            Console.ReadLine();
        }
Пример #3
0
        public static BplusTreeBytes Initialize(System.IO.Stream treefile, System.IO.Stream blockfile, int KeyLength, int CultureId,
                                                int nodesize, int buffersize)
        {
            BplusTreeLong tree    = BplusTreeLong.InitializeInStream(treefile, KeyLength, nodesize, CultureId);
            LinkedFile    archive = LinkedFile.InitializeLinkedFileInStream(blockfile, buffersize);

            return(new BplusTreeBytes(tree, archive));
        }
Пример #4
0
 public BplusTreeBytes(BplusTreeLong tree, LinkedFile archive)
 {
     this.tree    = tree;
     this.archive = archive;
 }
Пример #5
0
 public BplusTreeBytes(BplusTreeLong tree, LinkedFile archive)
 {
     m_tree    = tree;
     m_archive = archive;
 }