Esempio n. 1
0
        private Page GetNestedMultiValuePage(byte *nestedPagePtr, NodeHeader *currentNode)
        {
            var nestedPage = new Page(nestedPagePtr, "multi tree", (ushort)NodeHeader.GetDataSize(_tx, currentNode));

            Debug.Assert(nestedPage.PageNumber == -1); // nested page marker
            return(nestedPage);
        }
Esempio n. 2
0
        private unsafe static void RenderPage(Transaction tx, Page page, TextWriter sw, string text, bool open)
        {
            sw.WriteLine(
                "<ul><li><input type='checkbox' id='page-{0}' {3} /><label for='page-{0}'>{4}: Page {0:#,#;;0} - {1} - {2:#,#;;0} entries</label><ul>",
                page.PageNumber, page.IsLeaf ? "Leaf" : "Branch", page.NumberOfEntries, open ? "checked" : "", text);

            for (int i = 0; i < page.NumberOfEntries; i++)
            {
                var nodeHeader = page.GetNode(i);
                if (page.IsLeaf)
                {
                    var key = new Slice(nodeHeader).ToString();
                    sw.Write("<li>{0} {1} - size: {2:#,#}</li>", key, nodeHeader->Flags, NodeHeader.GetDataSize(tx, nodeHeader));
                }
                else
                {
                    var key = new Slice(nodeHeader).ToString();

                    var pageNum = nodeHeader->PageNumber;

                    if (i == 0)
                    {
                        key = "[smallest]";
                    }

                    RenderPage(tx, tx.GetReadOnlyPage(pageNum), sw, key, false);
                }
            }
            sw.WriteLine("</ul></li></ul>");
        }