本文整理匯總了C#中Voron.Trees.Tree.Iterate方法的典型用法代碼示例。如果您正苦於以下問題:C# Tree.Iterate方法的具體用法?C# Tree.Iterate怎麽用?C# Tree.Iterate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Voron.Trees.Tree
的用法示例。
在下文中一共展示了Tree.Iterate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Keys
public unsafe List<Slice> Keys(Tree t, Transaction tx)
{
var results = new List<Slice>();
using (var it = t.Iterate())
{
if (it.Seek(Slice.BeforeAllKeys) == false)
return results;
do
{
results.Add(it.CurrentKey);
} while (it.MoveNext());
}
return results;
}
示例2: CreateMultiValuesReport
private MultiValuesReport CreateMultiValuesReport(Tree tree)
{
var multiValues = new MultiValuesReport();
using (var multiTreeIterator = tree.Iterate())
{
if (multiTreeIterator.Seek(Slice.BeforeAllKeys))
{
do
{
var currentNode = multiTreeIterator.Current;
switch (currentNode->Flags)
{
case NodeFlags.MultiValuePageRef:
{
var multiValueTreeHeader = (TreeRootHeader*) ((byte*) currentNode + currentNode->KeySize + Constants.NodeHeaderSize);
Debug.Assert(multiValueTreeHeader->Flags == TreeFlags.MultiValue);
multiValues.EntriesCount += multiValueTreeHeader->EntriesCount;
multiValues.BranchPages += multiValueTreeHeader->BranchPages;
multiValues.LeafPages += multiValueTreeHeader->LeafPages;
multiValues.PageCount += multiValueTreeHeader->PageCount;
break;
}
case NodeFlags.Data:
{
var nestedPage = GetNestedMultiValuePage(NodeHeader.DirectAccess(_tx, currentNode), currentNode);
multiValues.EntriesCount += nestedPage.NumberOfEntries;
break;
}
case NodeFlags.PageRef:
{
var overFlowPage = _tx.GetReadOnlyPage(currentNode->PageNumber);
var nestedPage = GetNestedMultiValuePage(overFlowPage.Base + Constants.PageHeaderSize, currentNode);
multiValues.EntriesCount += nestedPage.NumberOfEntries;
break;
}
default:
throw new InvalidEnumArgumentException("currentNode->Flags", (int) currentNode->Flags, typeof (NodeFlags));
}
} while (multiTreeIterator.MoveNext());
}
}
return multiValues;
}