|
xapian-core
2.0.0
|
The HoneyVersion class manages the revision files. More...
#include <honey_version.h>
Collaboration diagram for HoneyVersion:Private Member Functions | |
| void | serialise_stats () |
| void | unserialise_stats () |
Private Attributes | |
| honey_revision_number_t | rev = 0 |
| Honey::RootInfo | root [Honey::MAX_] |
| Honey::RootInfo | old_root [Honey::MAX_] |
| Uuid | uuid |
| The UUID of this database. More... | |
| int | fd |
| File descriptor. More... | |
| off_t | offset = 0 |
| Offset into the file at which the version data starts. More... | |
| std::string | db_dir |
| The database directory. More... | |
| Xapian::doccount | doccount = 0 |
| The number of documents in the database. More... | |
| Xapian::totallength | total_doclen = 0 |
| The total of the lengths of all documents in the database. More... | |
| Xapian::docid | last_docid = 0 |
| Greatest document id ever used in this database. More... | |
| Xapian::termcount | doclen_lbound = 0 |
| A lower bound on the smallest document length in this database. More... | |
| Xapian::termcount | doclen_ubound = 0 |
| An upper bound on the greatest document length in this database. More... | |
| Xapian::termcount | wdf_ubound = 0 |
| An upper bound on the greatest wdf in this database. More... | |
| Xapian::termcount | spelling_wordfreq_ubound = 0 |
| An upper bound on the spelling wordfreq in this database. More... | |
| honey_revision_number_t | oldest_changeset = 0 |
| Oldest changeset removed when max_changesets is set. More... | |
| Xapian::termcount | uniq_terms_lbound = 0 |
| A lower bound on the number of unique terms in a document in this database. More... | |
| Xapian::termcount | uniq_terms_ubound = 0 |
| An upper bound on the number of unique terms in a document in this database. More... | |
| std::string | serialised_stats |
| The serialised database stats. More... | |
The HoneyVersion class manages the revision files.
The "iamhoney" file (currently) contains a "magic" string identifying that this is a honey database, a database format version number, the UUID of the database, the revision of the database, and the root block info for each table.
Definition at line 79 of file honey_version.h.
|
inlineexplicit |
Definition at line 151 of file honey_version.h.
|
explicit |
Definition at line 94 of file honey_version.cc.
References fd, offset, rare, and Xapian::Internal::str().
| HoneyVersion::~HoneyVersion | ( | ) |
Definition at line 105 of file honey_version.cc.
|
inline |
Definition at line 244 of file honey_version.h.
References doccount, doclen_lbound, doclen_ubound, min_non_zero(), and total_doclen.
| void HoneyVersion::cancel | ( | ) |
Definition at line 345 of file honey_version.cc.
References LOGCALL_VOID, Honey::MAX_, old_root, root, and unserialise_stats().
|
inline |
Definition at line 263 of file honey_version.h.
References wdf_ubound.
| void HoneyVersion::create | ( | ) |
Create the version file.
Definition at line 475 of file honey_version.cc.
References compress_min_tab, Uuid::generate(), Honey::RootInfo::init(), Honey::MAX_, root, and uuid.
|
inline |
Definition at line 251 of file honey_version.h.
References doccount, doclen_lbound, doclen_ubound, total_doclen, and wdf_ubound.
|
inline |
Definition at line 194 of file honey_version.h.
References doccount.
Referenced by check_db_dir(), HoneyDatabase::get_doccount(), HoneyDatabase::get_used_docid_range(), and merge_stats().
|
inline |
Definition at line 200 of file honey_version.h.
References doclen_lbound.
Referenced by HoneyDatabase::get_doclength_lower_bound(), and merge_stats().
|
inline |
Definition at line 204 of file honey_version.h.
References doclen_ubound.
Referenced by HoneyDatabase::get_doclength_upper_bound(), and merge_stats().
|
inline |
Definition at line 198 of file honey_version.h.
References last_docid.
Referenced by check_db_dir(), HoneyDatabase::get_doclength(), HoneyDatabase::get_lastdocid(), and HoneyDatabase::get_used_docid_range().
|
inline |
Definition at line 267 of file honey_version.h.
References last_docid.
|
inline |
|
inline |
Definition at line 214 of file honey_version.h.
References oldest_changeset.
|
inline |
Definition at line 174 of file honey_version.h.
References rev.
Referenced by check_db_dir(), HoneyDatabase::get_revision(), HoneyDatabase::HoneyDatabase(), and main().
|
inline |
Definition at line 176 of file honey_version.h.
References root.
Referenced by HoneyDatabase::HoneyDatabase(), and main().
|
inline |
Definition at line 210 of file honey_version.h.
References spelling_wordfreq_ubound.
Referenced by merge_stats().
|
inline |
Definition at line 196 of file honey_version.h.
References total_doclen.
Referenced by HoneyDatabase::get_total_length(), and merge_stats().
|
inline |
Definition at line 218 of file honey_version.h.
References uniq_terms_lbound.
Referenced by HoneyDatabase::get_unique_terms_lower_bound(), and merge_stats().
|
inline |
Definition at line 222 of file honey_version.h.
References uniq_terms_ubound.
Referenced by HoneyDatabase::get_unique_terms_upper_bound(), and merge_stats().
|
inline |
Return pointer to 16 byte UUID.
Definition at line 185 of file honey_version.h.
References Uuid::data(), and uuid.
|
inline |
Return UUID in the standard 36 character string format.
Definition at line 190 of file honey_version.h.
References Uuid::to_string(), and uuid.
Referenced by HoneyDatabase::get_uuid().
|
inline |
Definition at line 208 of file honey_version.h.
References wdf_ubound.
Referenced by HoneyDatabase::get_wdf_upper_bound(), and merge_stats().
| void HoneyVersion::merge_stats | ( | const HoneyVersion & | o | ) |
Merge the database stats.
Used by compaction.
Definition at line 290 of file honey_version.cc.
References doccount, doclen_lbound, doclen_ubound, get_doccount(), get_doclength_lower_bound(), get_doclength_upper_bound(), get_spelling_wordfreq_upper_bound(), get_total_doclen(), get_unique_terms_lower_bound(), get_unique_terms_upper_bound(), get_wdf_upper_bound(), min_non_zero(), spelling_wordfreq_ubound, total_doclen, uniq_terms_lbound, uniq_terms_ubound, and wdf_ubound.
| void HoneyVersion::merge_stats | ( | Xapian::doccount | o_doccount, |
| Xapian::termcount | o_doclen_lbound, | ||
| Xapian::termcount | o_doclen_ubound, | ||
| Xapian::termcount | o_wdf_ubound, | ||
| Xapian::totallength | o_total_doclen, | ||
| Xapian::termcount | o_spelling_wordfreq_ubound, | ||
| Xapian::termcount | o_uniq_terms_lbound, | ||
| Xapian::termcount | o_uniq_terms_ubound | ||
| ) |
Definition at line 315 of file honey_version.cc.
References doccount, doclen_lbound, doclen_ubound, min_non_zero(), spelling_wordfreq_ubound, total_doclen, uniq_terms_lbound, uniq_terms_ubound, and wdf_ubound.
| void HoneyVersion::read | ( | ) |
Read the version file and check it's a version we understand.
On failure, an exception is thrown.
Definition at line 114 of file honey_version.cc.
References Uuid::assign(), Uuid::BINARY_SIZE, db_dir, fd, HONEY_FORMAT_VERSION, HONEY_VERSION_MAGIC, HONEY_VERSION_MAGIC_AND_VERSION_LEN, HONEY_VERSION_MAGIC_LEN, io_read(), LOGCALL_VOID, Honey::MAX_, O_BINARY, offset, old_root, p, posixy_open, rare, rev, root, serialised_stats, single_file(), Xapian::Internal::str(), unpack_uint(), unserialise_stats(), uuid, VERSION_TO_DAY, VERSION_TO_MONTH, and VERSION_TO_YEAR.
Referenced by check_db_dir(), check_db_table(), HoneyDatabase::HoneyDatabase(), and main().
|
inline |
Definition at line 180 of file honey_version.h.
References root.
|
private |
Definition at line 194 of file honey_version.cc.
References Assert, doccount, doclen_lbound, doclen_ubound, last_docid, oldest_changeset, pack_uint(), serialised_stats, spelling_wordfreq_ubound, total_doclen, uniq_terms_lbound, uniq_terms_ubound, and wdf_ubound.
Referenced by write().
|
inline |
Definition at line 226 of file honey_version.h.
References last_docid.
|
inline |
Definition at line 228 of file honey_version.h.
References oldest_changeset.
|
inline |
Definition at line 232 of file honey_version.h.
References spelling_wordfreq_ubound.
|
inline |
Definition at line 236 of file honey_version.h.
References uniq_terms_lbound.
|
inline |
Definition at line 240 of file honey_version.h.
References uniq_terms_ubound.
|
inline |
| bool HoneyVersion::sync | ( | const std::string & | tmpfile, |
| honey_revision_number_t | new_rev, | ||
| int | flags | ||
| ) |
Definition at line 405 of file honey_version.cc.
References Assert, close(), db_dir, Xapian::DB_FULL_SYNC, Xapian::DB_NO_SYNC, fd, io_full_sync(), io_sync(), io_tmp_rename(), Honey::MAX_, old_root, rev, root, and single_file().
|
private |
Definition at line 222 of file honey_version.cc.
References Assert, doccount, doclen_lbound, doclen_ubound, last_docid, oldest_changeset, p, serialised_stats, spelling_wordfreq_ubound, total_doclen, uniq_terms_lbound, uniq_terms_ubound, unpack_uint(), and wdf_ubound.
| const string HoneyVersion::write | ( | honey_revision_number_t | new_rev, |
| int | flags | ||
| ) |
Definition at line 355 of file honey_version.cc.
References Uuid::BINARY_SIZE, close(), Uuid::data(), Xapian::DB_DANGEROUS, db_dir, fd, HONEY_VERSION_MAGIC, HONEY_VERSION_MAGIC_AND_VERSION_LEN, io_write(), LOGCALL, Honey::MAX_, O_BINARY, pack_uint(), posixy_open, rare, RETURN, root, Honey::RootInfo::serialise(), serialise_stats(), serialised_stats, single_file(), and uuid.
|
private |
The database directory.
Definition at line 105 of file honey_version.h.
Referenced by check_honey_table(), read(), single_file(), sync(), and write().
|
private |
The number of documents in the database.
Definition at line 108 of file honey_version.h.
Referenced by add_document(), delete_document(), get_doccount(), merge_stats(), serialise_stats(), and unserialise_stats().
|
private |
A lower bound on the smallest document length in this database.
Definition at line 117 of file honey_version.h.
Referenced by add_document(), delete_document(), get_doclength_lower_bound(), merge_stats(), serialise_stats(), and unserialise_stats().
|
private |
An upper bound on the greatest document length in this database.
Definition at line 120 of file honey_version.h.
Referenced by add_document(), delete_document(), get_doclength_upper_bound(), merge_stats(), serialise_stats(), and unserialise_stats().
|
private |
File descriptor.
When committing, this hold the file descriptor of the new changes file between the call to the write() and sync() methods.
For a single-file database (when db_dir.empty()), this holds the fd of that file for use in read().
Definition at line 96 of file honey_version.h.
Referenced by check_honey_table(), HoneyVersion(), read(), sync(), write(), and ~HoneyVersion().
|
private |
Greatest document id ever used in this database.
Definition at line 114 of file honey_version.h.
Referenced by get_last_docid(), get_next_docid(), serialise_stats(), set_last_docid(), and unserialise_stats().
|
private |
Offset into the file at which the version data starts.
Will be 0, except for an embedded multi-file database.
Definition at line 102 of file honey_version.h.
Referenced by get_offset(), HoneyVersion(), and read().
|
private |
Definition at line 83 of file honey_version.h.
|
mutableprivate |
Oldest changeset removed when max_changesets is set.
Definition at line 129 of file honey_version.h.
Referenced by get_oldest_changeset(), serialise_stats(), set_oldest_changeset(), and unserialise_stats().
|
private |
Definition at line 80 of file honey_version.h.
Referenced by get_revision(), read(), and sync().
|
private |
Definition at line 82 of file honey_version.h.
Referenced by cancel(), create(), get_root(), read(), root_to_set(), sync(), and write().
|
private |
The serialised database stats.
Definition at line 142 of file honey_version.h.
Referenced by read(), serialise_stats(), unserialise_stats(), and write().
|
private |
An upper bound on the spelling wordfreq in this database.
Definition at line 126 of file honey_version.h.
Referenced by get_spelling_wordfreq_upper_bound(), merge_stats(), serialise_stats(), set_spelling_wordfreq_upper_bound(), and unserialise_stats().
|
private |
The total of the lengths of all documents in the database.
Definition at line 111 of file honey_version.h.
Referenced by add_document(), delete_document(), get_total_doclen(), merge_stats(), serialise_stats(), and unserialise_stats().
|
private |
A lower bound on the number of unique terms in a document in this database.
Definition at line 134 of file honey_version.h.
Referenced by get_unique_terms_lower_bound(), merge_stats(), serialise_stats(), set_unique_terms_lower_bound(), and unserialise_stats().
|
private |
An upper bound on the number of unique terms in a document in this database.
Definition at line 139 of file honey_version.h.
Referenced by get_unique_terms_upper_bound(), merge_stats(), serialise_stats(), set_unique_terms_upper_bound(), and unserialise_stats().
|
private |
The UUID of this database.
Definition at line 86 of file honey_version.h.
Referenced by create(), get_uuid(), get_uuid_string(), read(), and write().
|
private |
An upper bound on the greatest wdf in this database.
Definition at line 123 of file honey_version.h.
Referenced by check_wdf(), delete_document(), get_wdf_upper_bound(), merge_stats(), serialise_stats(), and unserialise_stats().