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