Abstraction for reading a stream of blocks from a commit log file.
More...
#include <CommitLogBlockStream.h>
Abstraction for reading a stream of blocks from a commit log file.
Definition at line 62 of file CommitLogBlockStream.h.
CommitLogBlockStream::CommitLogBlockStream |
( |
FilesystemPtr & |
fs, |
|
|
const std::string & |
log_dir, |
|
|
const std::string & |
fragment |
|
) |
| |
CommitLogBlockStream::~CommitLogBlockStream |
( |
| ) |
|
|
virtual |
bool CommitLogBlockStream::archive_bad_fragment |
( |
const std::string & |
fname, |
|
|
std::string & |
archive_fname |
|
) |
| |
|
private |
void CommitLogBlockStream::close |
( |
| ) |
|
std::string& Hypertable::CommitLogBlockStream::get_fname |
( |
| ) |
|
|
inline |
uint64_t CommitLogBlockStream::header_size |
( |
| ) |
|
|
static |
void CommitLogBlockStream::load |
( |
const std::string & |
log_dir, |
|
|
const std::string & |
fragment |
|
) |
| |
bool CommitLogBlockStream::read_header |
( |
FilesystemPtr & |
fs, |
|
|
int32_t |
fd, |
|
|
uint32_t * |
versionp, |
|
|
uint64_t * |
next_offset |
|
) |
| |
|
static |
Reads commit log file header.
This function assumes that fd
is a valid file descriptor for a commit log file that is opened for reading and positioned at the beginning of the file. It reads the header and extracts the version number, saving it to *versionp
, and sets *next_offset
to the file offset immediately following the header. If the header is invalid, it implies that the file is in the original format that did not have the header. In this case, *versionp
is set to zero, *next_offset
is set to zero, and false is returned.
- Parameters
-
fs | Reference to filesystem object |
fd | File descriptor of newly opened commit log file |
versionp | Address of variable to hold version read from header |
next_offset | Address of file offset variable positioned to first byte after the header |
- Returns
- true if valid header was encountered, false otherwise
Definition at line 183 of file CommitLogBlockStream.cc.
void CommitLogBlockStream::write_header |
( |
FilesystemPtr & |
fs, |
|
|
int32_t |
fd |
|
) |
| |
|
static |
Writes commit log file header.
This function assumes that fd
is a valid file descriptor for a commit log file that is opened for writing and positioned at the beginning of the file. The header that is written consists of eight bytes and has the following format:
vNNNN\f\n\0
The NNNN
component consists of four ASCII digits that represent the latest version number. The formfeed+newline allows the verison number to be displayed by running the Unix more
on the file, which will display the version number and then pause the output.
- Parameters
-
fs | Reference to filesystem object |
fd | File descriptor of newly opened commit log file |
Definition at line 209 of file CommitLogBlockStream.cc.
uint64_t Hypertable::CommitLogBlockStream::m_cur_offset |
|
private |
int32_t Hypertable::CommitLogBlockStream::m_fd |
|
private |
uint64_t Hypertable::CommitLogBlockStream::m_file_length |
|
private |
std::string Hypertable::CommitLogBlockStream::m_fname |
|
private |
std::string Hypertable::CommitLogBlockStream::m_fragment |
|
private |
std::string Hypertable::CommitLogBlockStream::m_log_dir |
|
private |
uint32_t Hypertable::CommitLogBlockStream::m_version |
|
private |
bool CommitLogBlockStream::ms_assert_on_error = true |
|
static |
The documentation for this class was generated from the following files: