本文整理汇总了C#中Voron.Trees.Page.CreateNewEmptyKey方法的典型用法代码示例。如果您正苦于以下问题:C# Page.CreateNewEmptyKey方法的具体用法?C# Page.CreateNewEmptyKey怎么用?C# Page.CreateNewEmptyKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voron.Trees.Page
的用法示例。
在下文中一共展示了Page.CreateNewEmptyKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandMultiTreeNestedPageSize
private void ExpandMultiTreeNestedPageSize(Transaction tx, Slice key, Slice value, byte* nestedPagePtr, ushort newSize, int currentSize)
{
Debug.Assert(newSize > currentSize);
TemporaryPage tmp;
using (tx.Environment.GetTemporaryPage(tx, out tmp))
{
var tempPagePointer = tmp.TempPagePointer;
NativeMethods.memcpy(tempPagePointer, nestedPagePtr, currentSize);
Delete(key); // release our current page
Page nestedPage = new Page(tempPagePointer, "multi tree", (ushort)currentSize);
var ptr = DirectAdd(key, newSize);
var newNestedPage = new Page(ptr, "multi tree", newSize)
{
Lower = (ushort)Constants.PageHeaderSize,
Upper = KeysPrefixing ? (ushort) (newSize - Constants.PrefixInfoSectionSize) : newSize,
Flags = KeysPrefixing ? PageFlags.Leaf | PageFlags.KeysPrefixed : PageFlags.Leaf,
PageNumber = -1L // mark as invalid page number
};
newNestedPage.ClearPrefixInfo();
MemorySlice nodeKey = nestedPage.CreateNewEmptyKey();
for (int i = 0; i < nestedPage.NumberOfEntries; i++)
{
var nodeHeader = nestedPage.GetNode(i);
nestedPage.SetNodeKey(nodeHeader, ref nodeKey);
nodeKey = newNestedPage.PrepareKeyToInsert(nodeKey, i);
newNestedPage.AddDataNode(i, nodeKey, 0,
(ushort)(nodeHeader->Version - 1)); // we dec by one because AdddataNode will inc by one, and we don't want to change those values
}
newNestedPage.Search(value);
newNestedPage.AddDataNode(newNestedPage.LastSearchPosition, newNestedPage.PrepareKeyToInsert(value, newNestedPage.LastSearchPosition), 0, 0);
}
}
示例2: PageIterator
public PageIterator(Page page)
{
_page = page;
_currentInternalKey = page.CreateNewEmptyKey();
}