18 #ifndef FOEDUS_SNAPSHOT_LOG_BUFFER_HPP_
19 #define FOEDUS_SNAPSHOT_LOG_BUFFER_HPP_
83 SortedBuffer(
char* buffer, uint64_t buffer_size, uint64_t total_size)
140 uint64_t abosulte_begin,
141 uint64_t abosulte_end,
142 uint32_t shortest_key_length,
143 uint32_t longest_key_length) {
170 virtual std::string
to_string()
const = 0;
173 virtual void describe(std::ostream* o)
const = 0;
259 void describe(
std::ostream* o) const CXX11_OVERRIDE;
261 fs::DirectIoFile*
get_file()
const {
return file_; }
266 kAlignment = 1 << 12,
274 #endif // FOEDUS_SNAPSHOT_LOG_BUFFER_HPP_
Packages handling of 4-bytes representation of position in log buffers.
uint64_t to_absolute_pos(uint64_t relative_pos) const
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.
Forward declarations of classes in filesystem package.
~DumpFileSortedBuffer() override
BufferPosition to_buffer_position(uint64_t byte_position)
ErrorCode wind(uint64_t next_absolute_pos) override
Loads next data block to be consumed by the caller (composer).
Typedefs of ID types used in snapshot package.
uint32_t StorageId
Unique ID for storage.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
uint64_t get_total_size() const
Returns the total size of the underlying stream (eg file size).
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()
const char * get_buffer() const
Returns the buffer memory.
uint32_t BufferPosition
Represents a position in some buffer.
virtual ErrorCode wind(uint64_t next_absolute_pos)=0
Loads next data block to be consumed by the caller (composer).
uint32_t get_cur_block_longest_key_length() const
Current storage block's longest key length.
std::string to_string() const override
Returns a short string that briefly describes this object.
Represents one input stream of sorted log entries.
Declares common log types used in all packages.
uint64_t cur_block_abosulte_begin_
see get_cur_block_abosulte_begin()
uint64_t get_offset() const
Returns the absolute byte position of the buffer's beginning in the entire file.
void describe_base_elements(std::ostream *o) const
void invalidate_current_block()
uint64_t from_buffer_position(BufferPosition buffer_position)
uint64_t get_cur_block_abosulte_begin() const
Current storage block's beginning in absolute byte position in the file.
virtual std::string to_string() const =0
Returns a short string that briefly describes this object.
fs::DirectIoFile * get_file() const
friend std::ostream & operator<<(std::ostream &o, const SortedBuffer &v)
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.
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
uint32_t get_cur_block_shortest_key_length() const
Current storage block's shortest key length.
void describe(std::ostream *o) const override
Writes out a detailed description of this object to stream.
InMemorySortedBuffer(char *buffer, uint64_t buffer_size)
~InMemorySortedBuffer() override
uint32_t get_cur_block_log_count() const
A slice of foedus::memory::AlignedMemory.
uint64_t to_relative_pos(uint64_t absolute_pos) const
Implementation of SortedBuffer that is backed by a dumped file.
uint32_t cur_block_shortest_key_length_
additional statistics for masstree/hash
std::string to_string() const override
Returns a short string that briefly describes this object.
BufferPosition compact(const log::RecordLogType *address) const
uint32_t cur_block_log_count_
LogBuffer(char *base_address)
#define CXX11_OVERRIDE
Used in public headers in place of "override" of C++11.
SortedBuffer(char *buffer, uint64_t buffer_size, uint64_t total_size)
uint32_t cur_block_longest_key_length_
additional statistics for masstree/hash
Represents an I/O stream on one file without filesystem caching.
uint64_t get_cur_block_abosulte_end() const
Current storage block's end in absolute byte position in the file.
char *const base_address_
const memory::AlignedMemorySlice & get_io_buffer() const
const uint64_t buffer_size_
Base class for log type of record-wise operation.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
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)
Implementation of SortedBuffer that is backed by fully in-memory buffer.
bool is_valid_current_block() const
uint64_t cur_block_abosulte_end_
see get_cur_block_abosulte_end()
log::RecordLogType * resolve(BufferPosition position) const
ErrorCode
Enum of error codes defined in error_code.xmacro.
storage::StorageId get_cur_block_storage_id() const
uint64_t get_buffer_size() const
Returns the size of buffer memory.