本文整理汇总了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;
}
示例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
};
}
示例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;
}