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); }
public TreePage ModifyPage(long pageNumber) { var newPage = _llt.ModifyPage(pageNumber).ToTreePage(); newPage.Dirty = true; _recentlyFoundPages.Reset(pageNumber); PageModified?.Invoke(pageNumber); return(newPage); }
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); }
protected void EnsureHeaderModified() { var page = _tx.ModifyPage(_sectionHeader->PageNumber); _sectionHeader = (RawDataSmallSectionPageHeader *)page.Pointer; }
internal TreePage GetWriteableTreePage(long pageNumber) { var page = _llt.ModifyPage(pageNumber); return(new TreePage(page.Pointer, Constants.Storage.PageSize)); }