libfoedus-core
FOEDUS Core Library
|
Abstracts how we batch-read several HashComposedBinsPage emit from individual composers. More...
Abstracts how we batch-read several HashComposedBinsPage emit from individual composers.
This buffer is instantiated for each child of each HashRootInfoPage, which has several HashComposedBinsPage contiguously. We batch-read them to reduce I/O.
Definition at line 118 of file hash_composed_bins_impl.hpp.
#include <hash_composed_bins_impl.hpp>
Public Types | |
enum | Constants { kMinBufferSize = 1 << 6 } |
Public Member Functions | |
void | init (cache::SnapshotFileSet *fileset, SnapshotPagePointer head_page_id, uint32_t total_pages, uint32_t buffer_size, HashComposedBinsPage *buffer) |
ErrorCode | next_pages () |
Read pages to buffer_. More... | |
ErrorCode | next_bin () __attribute__((always_inline)) |
Moves on to next bin. More... | |
const HashComposedBinsPage & | get_cur_page () const __attribute__((always_inline)) |
const ComposedBin & | get_cur_bin () const __attribute__((always_inline)) |
bool | has_more () const |
Static Public Member Functions | |
static void | assure_read_buffer_size (memory::AlignedMemory *read_buffer, uint32_t inputs) |
If needed, expand the given read buffer to be used with the inputs. More... | |
Public Attributes | |
cache::SnapshotFileSet * | fileset_ |
file handles More... | |
SnapshotPagePointer | head_page_id_ |
Page ID of the head of HashComposedBinsPage for this sub-tree. More... | |
uint32_t | total_pages_ |
Number of HashComposedBinsPage from head_page_id_ contiguously emit by a composer. More... | |
uint32_t | buffer_size_ |
How many pages buffer_ can hold. More... | |
uint32_t | buffer_pos_ |
index (0=head, total_pages_ - 1=tail, ) of the first page in the buffer_. More... | |
uint32_t | buffer_count_ |
number of pages so far read in the buffer_. More... | |
uint32_t | cursor_buffer_ |
Cursor position for page in the buffer. More... | |
uint16_t | cursor_bin_ |
Cursor position for bin in the current page. More... | |
uint16_t | cursor_bin_count_ |
Number of active bins in the current page. More... | |
HashComposedBinsPage * | buffer_ |
The buffer to read contiguous pages in one shot. More... | |
|
static |
If needed, expand the given read buffer to be used with the inputs.
We split the one read buffer for inputs, so each input might not receive a large enough buffer to read HashComposedBinsPage.
Definition at line 74 of file hash_composed_bins_impl.cpp.
References ASSERT_ND, foedus::memory::AlignedMemory::assure_capacity(), foedus::memory::AlignedMemory::get_size(), kMinBufferSize, and foedus::storage::kPageSize.
Referenced by foedus::storage::hash::ComposedBinsMergedStream::init().
|
inline |
Definition at line 190 of file hash_composed_bins_impl.hpp.
References ASSERT_ND, foedus::storage::hash::HashComposedBinsPage::bins_, cursor_bin_, get_cur_page(), and has_more().
Referenced by foedus::storage::hash::ComposedBinsMergedStream::init(), and foedus::storage::hash::ComposedBinsMergedStream::process_a_bin().
|
inline |
Definition at line 183 of file hash_composed_bins_impl.hpp.
References cursor_buffer_.
Referenced by get_cur_bin().
|
inline |
Definition at line 196 of file hash_composed_bins_impl.hpp.
References total_pages_.
Referenced by get_cur_bin(), foedus::storage::hash::ComposedBinsMergedStream::init(), and foedus::storage::hash::ComposedBinsMergedStream::process_a_bin().
void foedus::storage::hash::ComposedBinsBuffer::init | ( | cache::SnapshotFileSet * | fileset, |
SnapshotPagePointer | head_page_id, | ||
uint32_t | total_pages, | ||
uint32_t | buffer_size, | ||
HashComposedBinsPage * | buffer | ||
) |
Definition at line 33 of file hash_composed_bins_impl.cpp.
References buffer_, buffer_count_, buffer_pos_, buffer_size_, cursor_bin_, cursor_bin_count_, cursor_buffer_, fileset_, head_page_id_, and total_pages_.
Referenced by foedus::storage::hash::ComposedBinsMergedStream::init().
|
inline |
Moves on to next bin.
Definition at line 268 of file hash_composed_bins_impl.hpp.
References foedus::storage::hash::HashComposedBinsPage::bin_count_, buffer_, buffer_count_, cursor_bin_, cursor_bin_count_, cursor_buffer_, foedus::kErrorCodeOk, LIKELY, and next_pages().
Referenced by foedus::storage::hash::ComposedBinsMergedStream::process_a_bin().
ErrorCode foedus::storage::hash::ComposedBinsBuffer::next_pages | ( | ) |
Read pages to buffer_.
This doesn't return error even when buffer_pos_ + buffer_cursor_count_ ==total_pages_, in which case this method does nothing. Use has_more() to check for that.
Definition at line 51 of file hash_composed_bins_impl.cpp.
References ASSERT_ND, foedus::storage::hash::HashComposedBinsPage::bin_count_, buffer_, buffer_count_, buffer_pos_, buffer_size_, CHECK_ERROR_CODE, cursor_bin_, cursor_bin_count_, cursor_buffer_, fileset_, head_page_id_, foedus::kErrorCodeOk, foedus::cache::SnapshotFileSet::read_pages(), and total_pages_.
Referenced by next_bin().
HashComposedBinsPage* foedus::storage::hash::ComposedBinsBuffer::buffer_ |
The buffer to read contiguous pages in one shot.
Definition at line 153 of file hash_composed_bins_impl.hpp.
Referenced by init(), next_bin(), and next_pages().
uint32_t foedus::storage::hash::ComposedBinsBuffer::buffer_count_ |
number of pages so far read in the buffer_.
upto total_pages_.
Definition at line 136 of file hash_composed_bins_impl.hpp.
Referenced by init(), next_bin(), and next_pages().
uint32_t foedus::storage::hash::ComposedBinsBuffer::buffer_pos_ |
index (0=head, total_pages_ - 1=tail, ) of the first page in the buffer_.
When there is no more page to read, total_pages_.
Definition at line 134 of file hash_composed_bins_impl.hpp.
Referenced by init(), and next_pages().
uint32_t foedus::storage::hash::ComposedBinsBuffer::buffer_size_ |
How many pages buffer_ can hold.
Definition at line 129 of file hash_composed_bins_impl.hpp.
Referenced by init(), and next_pages().
uint16_t foedus::storage::hash::ComposedBinsBuffer::cursor_bin_ |
Cursor position for bin in the current page.
Definition at line 148 of file hash_composed_bins_impl.hpp.
Referenced by get_cur_bin(), init(), next_bin(), and next_pages().
uint16_t foedus::storage::hash::ComposedBinsBuffer::cursor_bin_count_ |
Number of active bins in the current page.
Definition at line 150 of file hash_composed_bins_impl.hpp.
Referenced by init(), next_bin(), and next_pages().
uint32_t foedus::storage::hash::ComposedBinsBuffer::cursor_buffer_ |
Cursor position for page in the buffer.
Definition at line 142 of file hash_composed_bins_impl.hpp.
Referenced by get_cur_page(), init(), next_bin(), and next_pages().
cache::SnapshotFileSet* foedus::storage::hash::ComposedBinsBuffer::fileset_ |
file handles
Definition at line 123 of file hash_composed_bins_impl.hpp.
Referenced by init(), and next_pages().
SnapshotPagePointer foedus::storage::hash::ComposedBinsBuffer::head_page_id_ |
Page ID of the head of HashComposedBinsPage for this sub-tree.
Definition at line 125 of file hash_composed_bins_impl.hpp.
Referenced by init(), and next_pages().
uint32_t foedus::storage::hash::ComposedBinsBuffer::total_pages_ |
Number of HashComposedBinsPage from head_page_id_ contiguously emit by a composer.
Definition at line 127 of file hash_composed_bins_impl.hpp.
Referenced by has_more(), init(), and next_pages().