예제 #1
0
        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);
        }
예제 #2
0
        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);
        }