private void AddToRecentlyFoundPages(List <long> c, TreePage p, bool leftmostPage, bool rightmostPage) { Slice firstKey; if (leftmostPage == true) { firstKey = Slices.BeforeAllKeys; } else { // We are going to store the slice, therefore we copy. firstKey = p.GetNodeKey(_llt, 0, ByteStringType.Immutable); } Slice lastKey; if (rightmostPage == true) { lastKey = Slices.AfterAllKeys; } else { // We are going to store the slice, therefore we copy. lastKey = p.GetNodeKey(_llt, p.NumberOfEntries - 1, ByteStringType.Immutable); } var foundPage = new RecentlyFoundTreePages.FoundTreePage(p.PageNumber, p, firstKey, lastKey, c.ToArray()); _recentlyFoundPages.Add(foundPage); }
private void AddToRecentlyFoundPages(TreeCursor c, TreePage p, bool leftmostPage, bool rightmostPage) { ByteStringContext.Scope firstScope, lastScope; Slice firstKey; if (leftmostPage) { firstScope = new ByteStringContext <ByteStringMemoryCache> .Scope(); firstKey = Slices.BeforeAllKeys; } else { // We are going to store the slice, therefore we copy. firstScope = p.GetNodeKey(_llt, 0, ByteStringType.Immutable, out firstKey); } Slice lastKey; if (rightmostPage) { lastScope = new ByteStringContext <ByteStringMemoryCache> .Scope(); lastKey = Slices.AfterAllKeys; } else { // We are going to store the slice, therefore we copy. lastScope = p.GetNodeKey(_llt, p.NumberOfEntries - 1, ByteStringType.Immutable, out lastKey); } 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 RecentlyFoundTreePages.FoundTreePage(p.PageNumber, p, firstKey, lastKey, cursorPath, firstScope, lastScope); _recentlyFoundPages.Add(foundPage); }
private void AddToRecentlyFoundPages(List <long> c, TreePage p, bool leftmostPage, bool rightmostPage) { Debug.Assert(p.IsCompressed == false); ByteStringContext.Scope firstScope, lastScope; Slice firstKey; if (leftmostPage) { firstScope = new ByteStringContext <ByteStringMemoryCache> .Scope(); firstKey = Slices.BeforeAllKeys; } else { // We are going to store the slice, therefore we copy. firstScope = p.GetNodeKey(_llt, 0, ByteStringType.Immutable, out firstKey); } Slice lastKey; if (rightmostPage) { lastScope = new ByteStringContext <ByteStringMemoryCache> .Scope(); lastKey = Slices.AfterAllKeys; } else { // We are going to store the slice, therefore we copy. lastScope = p.GetNodeKey(_llt, p.NumberOfEntries - 1, ByteStringType.Immutable, out lastKey); } var foundPage = new RecentlyFoundTreePages.FoundTreePage(p.PageNumber, p, firstKey, lastKey, c.ToArray(), firstScope, lastScope); _recentlyFoundPages.Add(foundPage); }