public async Task <IPage> SeekAndRead(ulong position, PageType pageType, IBufferPool bufferPool, ColumnInfo[] columnInfos) { // TODO: this level of serialization is super slow... await semaphore.WaitAsync().ConfigureAwait(false); try { this.fileStream.Seek((long)position, SeekOrigin.Begin); (Memory <byte> memory, ulong token) = bufferPool.GetMemory(); return(pageType switch { PageType.MixedPage => new MixedPage(this.binaryReader, memory, token, columnInfos), PageType.StringPage => new StringOnlyPage(this.binaryReader), _ => throw new ArgumentException() }); }