20 #include <glog/logging.h>
38 std::ostream& o = *optr;
39 o <<
"<buffer_>" <<
reinterpret_cast<const void*
>(
buffer_) <<
"</buffer_>"
41 <<
"<offset_>" <<
offset_ <<
"</offset_>"
42 <<
"<total_size_>" <<
total_size_ <<
"</total_size_>"
50 std::ostream& o = *optr;
51 o <<
"<InMemorySortedBuffer>";
53 o <<
"</InMemorySortedBuffer>";
60 reinterpret_cast<char*>(io_buffer.get_block()),
64 io_buffer_(io_buffer) {
70 return std::string(
"DumpFileSortedBuffer: ") + file_->
get_path().
string();
74 std::ostream& o = *optr;
75 o <<
"<DumpFileSortedBuffer>";
77 o <<
"<file_>" << file_ <<
"</file_>";
78 o <<
"<io_buffer_>" << io_buffer_ <<
"</io_buffer_>";
79 o <<
"</DumpFileSortedBuffer>";
87 }
else if (next_absolute_pos <
offset_ ||
91 LOG(FATAL) <<
" wtf next_absolute_pos=" << next_absolute_pos <<
", offset=" <<
offset_
101 uint64_t retained_bytes
109 uint64_t desired_reads = std::min(
ErrorCode wind(uint64_t next_absolute_pos) override
Loads next data block to be consumed by the caller (composer).
DumpFileSortedBuffer(fs::DirectIoFile *file, memory::AlignedMemorySlice io_buffer)
wraps the given file as a buffer.
0x0002 : "GENERAL: Invalid parameter given" .
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
void describe(std::ostream *o) const override
Writes out a detailed description of this object to stream.
const uint64_t total_size_
see get_total_size()
uint64_t offset_
see get_offset()
std::string to_string() const override
Returns a short string that briefly describes this object.
Represents one input stream of sorted log entries.
uint64_t get_current_offset() const
uint64_t cur_block_abosulte_begin_
see get_cur_block_abosulte_begin()
void describe_base_elements(std::ostream *o) const
storage::StorageId cur_block_storage_id_
If this is zero, this buffer is not set for reading any block.
virtual void describe(std::ostream *o) const =0
Writes out a detailed description of this object to stream.
void describe(std::ostream *o) const override
Writes out a detailed description of this object to stream.
const std::string & string() const
ErrorCode read(uint64_t desired_bytes, foedus::memory::AlignedMemory *buffer)
Sequentially read the given amount of contents from the current position.
A slice of foedus::memory::AlignedMemory.
uint64_t file_size(const Path &p)
Returns size of the file.
uint32_t cur_block_log_count_
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
Represents an I/O stream on one file without filesystem caching.
const uint64_t buffer_size_
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
uint64_t cur_block_abosulte_end_
see get_cur_block_abosulte_end()
ErrorCode
Enum of error codes defined in error_code.xmacro.
std::ostream & operator<<(std::ostream &o, const SortedBuffer &v)