#include <chert_version.h>

Public Member Functions | |
| ChertVersion (const std::string &dbdir) | |
| void | create () |
| Create the version file. | |
| void | read_and_check () |
| Read the version file and check it's a version we understand. | |
| const char * | get_uuid () const |
| Return pointer to 16 byte UUID. | |
| std::string | get_uuid_string () const |
| Return UUID in the standard 36 character string format. | |
| void | set_uuid (void *data) |
| Set the UUID from 16 byte binary value data. | |
| bool | set_uuid_string (const std::string &s) |
| Set the UUID from the standard 36 character string format. | |
Private Attributes | |
| std::string | filename |
| The filename of the version file. | |
| uuid_t | uuid |
| The UUID of this database. | |
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.
| ChertVersion::ChertVersion | ( | const std::string & | dbdir | ) | [inline] |
| void ChertVersion::create | ( | ) |
Create the version file.
Definition at line 64 of file chert_version.cc.
References CHERT_VERSION, filename, io_write(), MAGIC_LEN, MAGIC_STRING, O_BINARY, Xapian::InMemory::open(), uuid, uuid_generate(), and VERSIONFILE_SIZE.
Referenced by ChertDatabase::create_and_open_tables().
| const char* ChertVersion::get_uuid | ( | ) | const [inline] |
| std::string ChertVersion::get_uuid_string | ( | ) | const [inline] |
Return UUID in the standard 36 character string format.
Definition at line 65 of file chert_version.h.
References uuid, and uuid_unparse_lower().
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 99 of file chert_version.cc.
References CHERT_VERSION, CompileTimeAssert, filename, io_read(), MAGIC_LEN, MAGIC_STRING, O_BINARY, Xapian::InMemory::open(), Xapian::Internal::str(), STRINGIZE, uuid, VERSIONFILE_SIZE, and VERSIONFILE_SIZE_LITERAL.
Referenced by ChertDatabaseReplicator::get_uuid(), ChertDatabase::open_tables(), and ChertDatabase::open_tables_consistent().
| void ChertVersion::set_uuid | ( | void * | data | ) | [inline] |
Set the UUID from 16 byte binary value data.
Definition at line 72 of file chert_version.h.
References uuid.
| bool ChertVersion::set_uuid_string | ( | const std::string & | s | ) | [inline] |
Set the UUID from the standard 36 character string format.
Definition at line 80 of file chert_version.h.
References uuid, and uuid_parse().
std::string ChertVersion::filename [private] |
The filename of the version file.
Definition at line 36 of file chert_version.h.
Referenced by ChertVersion(), create(), and read_and_check().
uuid_t ChertVersion::uuid [mutable, private] |
The UUID of this database.
This is mutable for older uuid libraries which take non-const uuid_t.
Definition at line 42 of file chert_version.h.
Referenced by create(), get_uuid(), get_uuid_string(), read_and_check(), set_uuid(), and set_uuid_string().