Example #1
0
        private void AddToRecentlyFoundPages(Cursor c, Page p, bool?leftmostPage, bool?rightmostPage)
        {
            MemorySlice firstKey;

            if (leftmostPage == true)
            {
                if (p.KeysPrefixed)
                {
                    firstKey = PrefixedSlice.BeforeAllKeys;
                }
                else
                {
                    firstKey = Slice.BeforeAllKeys;
                }
            }
            else
            {
                firstKey = p.GetNodeKey(0);
            }

            MemorySlice lastKey;

            if (rightmostPage == true)
            {
                if (p.KeysPrefixed)
                {
                    lastKey = PrefixedSlice.AfterAllKeys;
                }
                else
                {
                    lastKey = Slice.AfterAllKeys;
                }
            }
            else
            {
                lastKey = p.GetNodeKey(p.NumberOfEntries - 1);
            }

            var cursorPath = new long[c.Pages.Count];

            var cur = c.Pages.First;
            int pos = cursorPath.Length - 1;

            while (cur != null)
            {
                cursorPath[pos--] = cur.Value.PageNumber;
                cur = cur.Next;
            }

            var foundPage = new RecentlyFoundPages.FoundPage(p.PageNumber, p, firstKey, lastKey, cursorPath);

            RecentlyFoundPages.Add(foundPage);
        }
Example #2
0
        private void AddToRecentlyFoundPages(Cursor c, Page p, bool?leftmostPage, bool?rightmostPage)
        {
            var foundPage = new RecentlyFoundPages.FoundPage(c.Pages.Count)
            {
                Number = p.PageNumber
            };

            if (leftmostPage == true)
            {
                if (p.KeysPrefixed)
                {
                    foundPage.FirstKey = PrefixedSlice.BeforeAllKeys;
                }
                else
                {
                    foundPage.FirstKey = Slice.BeforeAllKeys;
                }
            }
            else
            {
                foundPage.FirstKey = p.GetNodeKey(0);
            }

            if (rightmostPage == true)
            {
                if (p.KeysPrefixed)
                {
                    foundPage.LastKey = PrefixedSlice.AfterAllKeys;
                }
                else
                {
                    foundPage.LastKey = Slice.AfterAllKeys;
                }
            }
            else
            {
                foundPage.LastKey = p.GetNodeKey(p.NumberOfEntries - 1);
            }

            var cur = c.Pages.First;
            int pos = foundPage.CursorPath.Length - 1;

            while (cur != null)
            {
                foundPage.CursorPath[pos--] = cur.Value.PageNumber;
                cur = cur.Next;
            }

            RecentlyFoundPages.Add(foundPage);
        }
Example #3
0
        internal void AddRecentlyFoundPage(Tree tree, RecentlyFoundPages.FoundPage foundPage)
        {
            RecentlyFoundPages pages;
            if (_recentlyFoundPages.TryGetValue(tree, out pages) == false)
                _recentlyFoundPages[tree] = pages = new RecentlyFoundPages(Flags == TransactionFlags.Read ? 8 : 2);

            pages.Add(foundPage);
        }