當前位置: 首頁>>代碼示例>>C#>>正文


C# Tree.Add方法代碼示例

本文整理匯總了C#中Voron.Trees.Tree.Add方法的典型用法代碼示例。如果您正苦於以下問題:C# Tree.Add方法的具體用法?C# Tree.Add怎麽用?C# Tree.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Voron.Trees.Tree的用法示例。


在下文中一共展示了Tree.Add方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddEntries

        private List<string> AddEntries(Tree tree, int treeNumber)
        {
            var entriesAdded = new List<string>();

            for (int j = 0; j < treeNumber; j++)
            {
                string key = "value_" + j;
                tree.Add(key, new MemoryStream(new byte[128]));
                entriesAdded.Add(key);
            }

            return entriesAdded;
        }
開發者ID:j2jensen,項目名稱:ravendb,代碼行數:13,代碼來源:StorageReportGenerationTests.cs

示例2: AddOverflows

        private OverflowsAddResult AddOverflows(Transaction tx, Tree tree, int treeNumber, Random r)
        {
            var minOverflowSize = AbstractPager.NodeMaxSize - Constants.PageHeaderSize + 1;
            var entriesAdded = new List<string>();
            var overflowsAdded = 0;

            for (int j = 0; j < treeNumber; j++)
            {
                var overflowSize = r.Next(minOverflowSize, 10000);
                string key = "overflow_" + j;
                tree.Add(key, new MemoryStream(new byte[overflowSize]));

                entriesAdded.Add(key);
                overflowsAdded += tx.DataPager.GetNumberOfOverflowPages(overflowSize);
            }

            return new OverflowsAddResult
            {
                AddedEntries = entriesAdded,
                NumberOfOverflowPages = overflowsAdded
            };
        }
開發者ID:j2jensen,項目名稱:ravendb,代碼行數:22,代碼來源:StorageReportGenerationTests.cs

示例3: put_doc

        private void put_doc(Random r, Guid etag, Dictionary<Guid, string> inMemoryKeysByEtag, HashSet<string> inMemoryKeys, string docKey, Tree docsTree, Tree metadataTree, Tree indexTree)
        {
            var docMetadata = new byte[r.Next(100, 7000)];

            Array.Copy(etag.ToByteArray(), docMetadata, 16);

            if (inMemoryKeys.Add(docKey) == false)
            {
                // update
                var existingEtag = inMemoryKeysByEtag.First(x => x.Value == docKey).Key;

                indexTree.Delete(existingEtag.ToString());
                inMemoryKeysByEtag.Remove(existingEtag);
            }

            docsTree.Add(docKey, get_doc_data(r));
            metadataTree.Add(docKey, docMetadata);
            indexTree.Add(etag.ToString(), docKey);

            inMemoryKeysByEtag[etag] = docKey;
        }
開發者ID:IdanHaim,項目名稱:ravendb,代碼行數:21,代碼來源:DataInconsistencyRepro.cs


注:本文中的Voron.Trees.Tree.Add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。