xapian-core
1.4.27
|
The ChertVersion class manages the "iamchert" file. More...
#include <chert_version.h>
Public Member Functions | |
ChertVersion (const std::string &dbdir) | |
void | create () |
Create the version file. More... | |
void | read_and_check () |
Read the version file and check it's a version we understand. More... | |
const char * | get_uuid () const |
Return pointer to 16 byte UUID. More... | |
std::string | get_uuid_string () const |
Return UUID in the standard 36 character string format. More... | |
Private Attributes | |
std::string | filename |
The filename of the version file. More... | |
Uuid | uuid |
The UUID of this database. More... | |
The ChertVersion class manages the "iamchert" file.
The "iamchert" file (currently) contains a "magic" string identifying that this is a chert database and a database format version number.
Definition at line 34 of file chert_version.h.
|
inlineexplicit |
Definition at line 42 of file chert_version.h.
References create(), and read_and_check().
void ChertVersion::create | ( | ) |
Create the version file.
Definition at line 57 of file chert_version.cc.
References CHERT_VERSION, close(), io_sync(), io_write(), MAGIC_LEN, MAGIC_STRING, O_BINARY, O_CLOEXEC, Xapian::InMemory::open(), and VERSIONFILE_SIZE.
Referenced by check_db_dir(), ChertVersion(), Xapian::Database::compact_(), and ChertDatabase::create_and_open_tables().
|
inline |
Return pointer to 16 byte UUID.
Definition at line 56 of file chert_version.h.
References Uuid::data().
|
inline |
Return UUID in the standard 36 character string format.
Definition at line 61 of file chert_version.h.
References Uuid::to_string().
Referenced by ChertDatabaseReplicator::get_uuid(), and ChertDatabase::get_uuid().
void ChertVersion::read_and_check | ( | ) |
Read the version file and check it's a version we understand.
On failure, an exception is thrown.
Definition at line 93 of file chert_version.cc.
References CHERT_VERSION, close(), io_read(), MAGIC_LEN, MAGIC_STRING, O_BINARY, O_CLOEXEC, Xapian::InMemory::open(), Xapian::Internal::str(), STRINGIZE, VERSIONFILE_SIZE, and VERSIONFILE_SIZE_LITERAL.
Referenced by check_db_dir(), ChertVersion(), ChertDatabaseReplicator::get_uuid(), ChertDatabase::open_tables(), and ChertDatabase::open_tables_consistent().
|
private |
The filename of the version file.
Definition at line 36 of file chert_version.h.
|
private |
The UUID of this database.
Definition at line 39 of file chert_version.h.