Thrill  0.1
KeepFileBlockSource Class Reference

Detailed Description

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.

Definition at line 349 of file file.hpp.

+ Collaboration diagram for KeepFileBlockSource:

#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< PinRequestPtrfetching_blocks_
 current prefetch operations More...
 
size_t fetching_bytes_
 current number of bytes in prefetch More...
 
const Filefile_
 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...
 

Constructor & Destructor Documentation

◆ KeepFileBlockSource()

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.

Definition at line 107 of file file.cpp.

Member Function Documentation

◆ AcquirePin()

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().

◆ MakeNextBlock()

◆ NextBlock()

◆ NextBlockUnpinned()

◆ Prefetch()

Member Data Documentation

◆ current_block_

size_t current_block_
private

◆ fetching_blocks_

std::deque<PinRequestPtr> fetching_blocks_
private

current prefetch operations

Definition at line 391 of file file.hpp.

Referenced by KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().

◆ fetching_bytes_

size_t fetching_bytes_
private

current number of bytes in prefetch

Definition at line 394 of file file.hpp.

Referenced by KeepFileBlockSource::NextBlock(), KeepFileBlockSource::NextBlockUnpinned(), and KeepFileBlockSource::Prefetch().

◆ file_

const File& file_
private

◆ first_block_

size_t first_block_
private

number of the first block

Definition at line 397 of file file.hpp.

Referenced by KeepFileBlockSource::MakeNextBlock().

◆ first_item_

size_t first_item_
private

offset of first item in first block read

Definition at line 403 of file file.hpp.

Referenced by KeepFileBlockSource::MakeNextBlock().

◆ keep_first_item

constexpr size_t keep_first_item = size_t(-1)
staticprivate

sentinel value for not changing the first_item item

Definition at line 379 of file file.hpp.

Referenced by KeepFileBlockSource::MakeNextBlock().

◆ local_worker_id_

size_t local_worker_id_
private

local worker id reading the File

Definition at line 385 of file file.hpp.

Referenced by KeepFileBlockSource::AcquirePin(), KeepFileBlockSource::NextBlock(), and KeepFileBlockSource::Prefetch().

◆ prefetch_size_

size_t prefetch_size_
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().


The documentation for this class was generated from the following files: