27 #ifndef Hypertable_Lib_CommitLogBlockStream_h
28 #define Hypertable_Lib_CommitLogBlockStream_h
68 const std::string &fragment);
71 void load(
const std::string &log_dir,
const std::string &fragment);
98 uint32_t *versionp, uint64_t *next_offset);
128 std::string &archive_fname);
161 #endif // Hypertable_Lib_CommitLogBlockStream_h
static bool ms_assert_on_error
Holds information about an individual block.
Abstract base class for a filesystem.
std::string m_fname
Full pathname of commit log fragment file.
std::string m_fragment
Fragment file name within commit log directory.
CommitLogBlockStream(FilesystemPtr &fs)
static void write_header(FilesystemPtr &fs, int32_t fd)
Writes commit log file header.
Abstraction for reading a stream of blocks from a commit log file.
virtual ~CommitLogBlockStream()
A dynamic, resizable and reference counted memory buffer.
uint64_t m_cur_offset
Current read offset within the fragment file.
int load_next_valid_header(BlockHeaderCommitLog *header)
A dynamic, resizable memory buffer.
FilesystemPtr m_fs
Pointer to filesystem.
int error
Error (if any) encountered while reading block
uint8_t * block_ptr
Pointer to beginning of compressed block.
bool archive_bad_fragment(const std::string &fname, std::string &archive_fname)
std::string & get_fname()
static bool read_header(FilesystemPtr &fs, int32_t fd, uint32_t *versionp, uint64_t *next_offset)
Reads commit log file header.
int32_t m_fd
File descriptor.
std::shared_ptr< Filesystem > FilesystemPtr
Smart pointer to Filesystem.
static uint64_t header_size()
Size of header.
uint64_t m_file_length
Length of commit log fragment file.
const char * log_dir
Log directory.
A String class based on std::string.
uint64_t start_offset
Starting offset of block within fragment file.
uint64_t end_offset
Ending offset of block within fragment file.
size_t block_len
Length of block.
bool next(CommitLogBlockInfo *, BlockHeaderCommitLog *)
void load(const std::string &log_dir, const std::string &fragment)
DynamicBuffer m_block_buffer
Buffer holding most recently loaded block.
uint32_t m_version
Version of commit log fragment file format.
const char * file_fragment
File name of log fragment within log_dir.
std::string m_log_dir
Directory containing commit log fragment file.