libfoedus-core
FOEDUS Core Library
|
Implementation of SortedBuffer that is backed by a dumped file. More...
Implementation of SortedBuffer that is backed by a dumped file.
When the reducer's buffer becomes full, it sorts all entries in it and dumps it to a file (sorted run file). This stream sequentially reads from the file.
Definition at line 247 of file log_buffer.hpp.
#include <log_buffer.hpp>
Public Member Functions | |
DumpFileSortedBuffer (fs::DirectIoFile *file, memory::AlignedMemorySlice io_buffer) | |
wraps the given file as a buffer. More... | |
~DumpFileSortedBuffer () override | |
std::string | to_string () const override |
Returns a short string that briefly describes this object. More... | |
ErrorCode | wind (uint64_t next_absolute_pos) override |
Loads next data block to be consumed by the caller (composer). More... | |
void | describe (std::ostream *o) const override |
Writes out a detailed description of this object to stream. More... | |
fs::DirectIoFile * | get_file () const |
const memory::AlignedMemorySlice & | get_io_buffer () const |
![]() | |
SortedBuffer (char *buffer, uint64_t buffer_size, uint64_t total_size) | |
virtual | ~SortedBuffer () |
uint64_t | to_relative_pos (uint64_t absolute_pos) const |
uint64_t | to_absolute_pos (uint64_t relative_pos) const |
const char * | get_buffer () const |
Returns the buffer memory. More... | |
uint64_t | get_buffer_size () const |
Returns the size of buffer memory. More... | |
uint64_t | get_offset () const |
Returns the absolute byte position of the buffer's beginning in the entire file. More... | |
uint64_t | get_total_size () const |
Returns the total size of the underlying stream (eg file size). More... | |
storage::StorageId | get_cur_block_storage_id () const |
uint32_t | get_cur_block_log_count () const |
uint64_t | get_cur_block_abosulte_begin () const |
Current storage block's beginning in absolute byte position in the file. More... | |
uint64_t | get_cur_block_abosulte_end () const |
Current storage block's end in absolute byte position in the file. More... | |
uint32_t | get_cur_block_shortest_key_length () const |
Current storage block's shortest key length. More... | |
uint32_t | get_cur_block_longest_key_length () const |
Current storage block's longest key length. More... | |
void | set_current_block (storage::StorageId storage_id, uint32_t log_count, uint64_t abosulte_begin, uint64_t abosulte_end, uint32_t shortest_key_length, uint32_t longest_key_length) |
bool | is_valid_current_block () const |
void | invalidate_current_block () |
void | assert_checks () |
Additional Inherited Members | |
![]() | |
void | describe_base_elements (std::ostream *o) const |
![]() | |
char *const | buffer_ |
const uint64_t | buffer_size_ |
uint64_t | offset_ |
see get_offset() More... | |
const uint64_t | total_size_ |
see get_total_size() More... | |
storage::StorageId | cur_block_storage_id_ |
If this is zero, this buffer is not set for reading any block. More... | |
uint32_t | cur_block_log_count_ |
uint64_t | cur_block_abosulte_begin_ |
see get_cur_block_abosulte_begin() More... | |
uint64_t | cur_block_abosulte_end_ |
see get_cur_block_abosulte_end() More... | |
uint32_t | cur_block_shortest_key_length_ |
additional statistics for masstree/hash More... | |
uint32_t | cur_block_longest_key_length_ |
additional statistics for masstree/hash More... | |
foedus::snapshot::DumpFileSortedBuffer::DumpFileSortedBuffer | ( | fs::DirectIoFile * | file, |
memory::AlignedMemorySlice | io_buffer | ||
) |
wraps the given file as a buffer.
note that this object does NOT take ownership of anything given to this constructor. it doesn't delete/open file or memory. it's caller's responsibility (in other words, this object is just a view. so is InMemorySortedBuffer).
Definition at line 57 of file log_buffer.cpp.
References ASSERT_ND, foedus::snapshot::SortedBuffer::buffer_size_, and foedus::snapshot::SortedBuffer::total_size_.
|
inlineoverride |
Definition at line 255 of file log_buffer.hpp.
|
overridevirtual |
Writes out a detailed description of this object to stream.
Implements foedus::snapshot::SortedBuffer.
Definition at line 73 of file log_buffer.cpp.
References foedus::snapshot::SortedBuffer::describe_base_elements().
|
inline |
Definition at line 261 of file log_buffer.hpp.
|
inline |
Definition at line 262 of file log_buffer.hpp.
|
overridevirtual |
Returns a short string that briefly describes this object.
Implements foedus::snapshot::SortedBuffer.
Definition at line 69 of file log_buffer.cpp.
References foedus::fs::DirectIoFile::get_path(), and foedus::fs::Path::string().
|
overridevirtual |
Loads next data block to be consumed by the caller (composer).
[in] | next_absolute_pos | the absolute byte position that will be guaranteed to be within the buffer after this method call. Note that this position might not become 0-th byte position after this method call because the buffer might be backed by an aligned File I/O. |
Implements foedus::snapshot::SortedBuffer.
Definition at line 82 of file log_buffer.cpp.
References foedus::snapshot::SortedBuffer::assert_checks(), ASSERT_ND, foedus::snapshot::SortedBuffer::buffer_, foedus::snapshot::SortedBuffer::buffer_size_, CHECK_ERROR_CODE, foedus::fs::DirectIoFile::get_current_offset(), foedus::kErrorCodeInvalidParameter, foedus::kErrorCodeOk, foedus::snapshot::SortedBuffer::offset_, foedus::fs::DirectIoFile::read(), and foedus::snapshot::SortedBuffer::total_size_.