Thrill
0.1
|
A BlockSource to read Blocks from a File.
The KeepFileBlockSource mainly contains an index to the current block, which is incremented when the NextBlock() must be delivered.
#include <file.hpp>
Public Member Functions | |
KeepFileBlockSource (const File &file, size_t local_worker_id, size_t prefetch_size=File::default_prefetch_size_, size_t first_block=0, size_t first_item=keep_first_item) | |
Start reading a File. More... | |
PinnedBlock | AcquirePin (const Block &block) |
Acquire Pin for Block returned from NextBlockUnpinned. More... | |
PinnedBlock | NextBlock () |
Block | NextBlockUnpinned () |
void | Prefetch (size_t prefetch_size) |
Perform prefetch. More... | |
Protected Member Functions | |
Block | MakeNextBlock () |
Private Attributes | |
size_t | current_block_ |
index of current block. More... | |
std::deque< PinRequestPtr > | fetching_blocks_ |
current prefetch operations More... | |
size_t | fetching_bytes_ |
current number of bytes in prefetch More... | |
const File & | file_ |
file to read blocks from More... | |
size_t | first_block_ |
number of the first block More... | |
size_t | first_item_ |
offset of first item in first block read More... | |
size_t | local_worker_id_ |
local worker id reading the File More... | |
size_t | prefetch_size_ |
number of bytes of prefetch for reader More... | |
Static Private Attributes | |
static constexpr size_t | keep_first_item = size_t(-1) |
sentinel value for not changing the first_item item More... | |
KeepFileBlockSource | ( | const File & | file, |
size_t | local_worker_id, | ||
size_t | prefetch_size = File::default_prefetch_size_ , |
||
size_t | first_block = 0 , |
||
size_t | first_item = keep_first_item |
||
) |
PinnedBlock AcquirePin | ( | const Block & | block | ) |
Acquire Pin for Block returned from NextBlockUnpinned.
Definition at line 192 of file file.cpp.
References KeepFileBlockSource::local_worker_id_, and Block::PinWait().
|
protected |
Determine current unpinned Block to deliver via NextBlock() or NextBlockUnpinned().
Definition at line 118 of file file.cpp.
References File::block(), KeepFileBlockSource::current_block_, KeepFileBlockSource::file_, KeepFileBlockSource::first_block_, KeepFileBlockSource::first_item_, KeepFileBlockSource::keep_first_item, and Block::set_begin().
Referenced by KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().
PinnedBlock NextBlock | ( | ) |
Advance to next block of file, delivers current_ and end_ for BlockReader
Definition at line 149 of file file.cpp.
References KeepFileBlockSource::current_block_, KeepFileBlockSource::fetching_blocks_, KeepFileBlockSource::fetching_bytes_, KeepFileBlockSource::file_, KeepFileBlockSource::local_worker_id_, KeepFileBlockSource::MakeNextBlock(), File::num_blocks(), Block::Pin(), Block::PinWait(), KeepFileBlockSource::prefetch_size_, Block::size(), and PinnedBlock::size().
Block NextBlockUnpinned | ( | ) |
Get next block unpinned, used by GetItemBatch to read Blocks without pinning them
Definition at line 177 of file file.cpp.
References KeepFileBlockSource::current_block_, KeepFileBlockSource::fetching_blocks_, KeepFileBlockSource::fetching_bytes_, KeepFileBlockSource::file_, KeepFileBlockSource::MakeNextBlock(), File::num_blocks(), KeepFileBlockSource::prefetch_size_, PinnedBlock::size(), and TLX_UNLIKELY.
void Prefetch | ( | size_t | prefetch_size | ) |
Perform prefetch.
Definition at line 131 of file file.cpp.
References KeepFileBlockSource::current_block_, KeepFileBlockSource::fetching_blocks_, KeepFileBlockSource::fetching_bytes_, KeepFileBlockSource::file_, KeepFileBlockSource::local_worker_id_, KeepFileBlockSource::MakeNextBlock(), File::num_blocks(), Block::Pin(), KeepFileBlockSource::prefetch_size_, and Block::size().
|
private |
index of current block.
Definition at line 400 of file file.hpp.
Referenced by KeepFileBlockSource::MakeNextBlock(), KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().
|
private |
current prefetch operations
Definition at line 391 of file file.hpp.
Referenced by KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().
|
private |
current number of bytes in prefetch
Definition at line 394 of file file.hpp.
Referenced by KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().
|
private |
file to read blocks from
Definition at line 382 of file file.hpp.
Referenced by KeepFileBlockSource::MakeNextBlock(), KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().
|
private |
number of the first block
Definition at line 397 of file file.hpp.
Referenced by KeepFileBlockSource::MakeNextBlock().
|
private |
offset of first item in first block read
Definition at line 403 of file file.hpp.
Referenced by KeepFileBlockSource::MakeNextBlock().
|
staticprivate |
sentinel value for not changing the first_item item
Definition at line 379 of file file.hpp.
Referenced by KeepFileBlockSource::MakeNextBlock().
|
private |
local worker id reading the File
Definition at line 385 of file file.hpp.
Referenced by KeepFileBlockSource::AcquirePin(), KeepFileBlockSource::NextBlock(), and KeepFileBlockSource::Prefetch().
|
private |
number of bytes of prefetch for reader
Definition at line 388 of file file.hpp.
Referenced by KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().