本文整理匯總了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;
}