Exemple #1
0
        public Page GetWritablePage(long pageNumber)
        {
            int position = current;

            int itemsLeft = _cache.Length;

            while (itemsLeft > 0)
            {
                int i = position % _cache.Length;

                // If the value is not valid or the page number is not equal
                if (!_cache[i].IsValid || _cache[i].PageNumber != pageNumber)
                {
                    // we continue.
                    itemsLeft--;
                    position++;

                    continue;
                }

                if (!_cache[i].IsWritable)
                {
                    _cache[i] = new PageHandlePtr(_tx.ModifyPage(pageNumber), true);
                }

                return(_cache[i].Value);
            }

            current         = (++current) % _cache.Length;
            _cache[current] = new PageHandlePtr(_tx.ModifyPage(pageNumber), true);
            return(_cache[current].Value);
        }
Exemple #2
0
        public TreePage ModifyPage(long pageNumber)
        {
            var newPage = _llt.ModifyPage(pageNumber).ToTreePage();

            newPage.Dirty = true;
            _recentlyFoundPages.Reset(pageNumber);

            PageModified?.Invoke(pageNumber);

            return(newPage);
        }
Exemple #3
0
        public Page GetWritablePage(long pageNumber)
        {
            var position = pageNumber & _andMask;

            PageData *node = &_cache[position];

            if (node->IsWritable && node->PageNumber == pageNumber)
            {
                return(node->Page);
            }

            var page = _tx.ModifyPage(pageNumber);

            node->PageNumber = pageNumber;
            node->Page       = page;
            node->IsWritable = true;

            return(page);
        }
Exemple #4
0
        protected void EnsureHeaderModified()
        {
            var page = _tx.ModifyPage(_sectionHeader->PageNumber);

            _sectionHeader = (RawDataSmallSectionPageHeader *)page.Pointer;
        }
Exemple #5
0
        internal TreePage GetWriteableTreePage(long pageNumber)
        {
            var page = _llt.ModifyPage(pageNumber);

            return(new TreePage(page.Pointer, Constants.Storage.PageSize));
        }