LogCabin
|
Assists in reading snapshot files from the local filesystem. More...
#include <SnapshotFile.h>
Public Member Functions | |
Reader (const Storage::Layout &storageLayout) | |
Constructor. | |
~Reader () | |
Destructor. | |
uint64_t | getSizeBytes () |
Return the size in bytes for the file. | |
uint64_t | getBytesRead () const |
Return the number of bytes read so far. | |
std::string | readMessage (google::protobuf::Message &message) |
Read a ProtoBuf message from the stream. | |
uint64_t | readRaw (void *data, uint64_t length) |
Read some raw bytes from the stream. | |
Private Attributes | |
Storage::FilesystemUtil::File | file |
Wraps the raw file descriptor; in charge of closing it when done. | |
std::unique_ptr < Storage::FilesystemUtil::FileContents > | contents |
Maps the file into memory for reading. | |
uint64_t | bytesRead |
The number of bytes read from the file. |
Assists in reading snapshot files from the local filesystem.
Definition at line 45 of file SnapshotFile.h.
LogCabin::Storage::SnapshotFile::Reader::Reader | ( | const Storage::Layout & | storageLayout | ) | [explicit] |
Constructor.
storageLayout | The directories in which to find the snapshot (in a file called "snapshot" in the snapshotDir). |
std::runtime_error | If the file can't be found. |
Definition at line 52 of file SnapshotFile.cc.
Destructor.
Definition at line 68 of file SnapshotFile.cc.
Return the size in bytes for the file.
Definition at line 73 of file SnapshotFile.cc.
uint64_t LogCabin::Storage::SnapshotFile::Reader::getBytesRead | ( | ) | const [virtual] |
Return the number of bytes read so far.
Implements LogCabin::Core::ProtoBuf::InputStream.
Definition at line 80 of file SnapshotFile.cc.
std::string LogCabin::Storage::SnapshotFile::Reader::readMessage | ( | google::protobuf::Message & | message | ) | [virtual] |
Read a ProtoBuf message from the stream.
Implements LogCabin::Core::ProtoBuf::InputStream.
Definition at line 86 of file SnapshotFile.cc.
uint64_t LogCabin::Storage::SnapshotFile::Reader::readRaw | ( | void * | data, |
uint64_t | length | ||
) | [virtual] |
Read some raw bytes from the stream.
Implements LogCabin::Core::ProtoBuf::InputStream.
Definition at line 131 of file SnapshotFile.cc.
Wraps the raw file descriptor; in charge of closing it when done.
Definition at line 68 of file SnapshotFile.h.
std::unique_ptr<Storage::FilesystemUtil::FileContents> LogCabin::Storage::SnapshotFile::Reader::contents [private] |
Maps the file into memory for reading.
Definition at line 70 of file SnapshotFile.h.
uint64_t LogCabin::Storage::SnapshotFile::Reader::bytesRead [private] |
The number of bytes read from the file.
Definition at line 72 of file SnapshotFile.h.