private byte *AcquirePagePointerInternal(IPagerLevelTransactionState tx, long pageNumber, PagerState pagerState) { if (DisposeOnceRunner.Disposed) { goto AlreadyDisposed; } if (pageNumber > NumberOfAllocatedPages || pageNumber < 0) { goto InvalidPageNumber; } var state = pagerState; if (state == null) { state = _pagerState; if (state == null) { goto AlreadyDisposed; } } tx?.EnsurePagerStateReference(state); return(state.MapBase + pageNumber * Constants.Storage.PageSize); AlreadyDisposed: ThrowAlreadyDisposedException(); InvalidPageNumber: ThrowOnInvalidPageNumber(pageNumber); return(null); // Will never happen. }
private byte* AcquirePagePointerInternal(IPagerLevelTransactionState tx, long pageNumber, PagerState pagerState) { var state = pagerState; if (DisposeOnceRunner.Disposed) goto AlreadyDisposed; if (pageNumber > NumberOfAllocatedPages || pageNumber < 0) goto InvalidPageNumber; if (state == null) { state = _pagerState; if (state == null) goto AlreadyDisposed; } tx?.EnsurePagerStateReference(ref state); if (state._released) goto InvalidPagerState; return state.MapBase + pageNumber * Constants.Storage.PageSize; AlreadyDisposed: ThrowAlreadyDisposedException(); InvalidPageNumber: ThrowOnInvalidPageNumber(pageNumber); InvalidPagerState: // ReSharper disable once PossibleNullReferenceException state.ThrowInvalidPagerState(); return null; // Will never happen. }
public virtual byte *AcquirePagePointer(IPagerLevelTransactionState tx, long pageNumber, PagerState pagerState = null) { if (Disposed) { ThrowAlreadyDisposedException(); } if (pageNumber > NumberOfAllocatedPages || pageNumber < 0) { ThrowOnInvalidPageNumber(pageNumber, tx?.Environment); } var state = pagerState ?? _pagerState; tx?.EnsurePagerStateReference(state); return(state.MapBase + pageNumber * _pageSize); }