|
xapian-core
1.4.30
|
The GlassVersion class manages the revision files. More...
#include <glass_version.h>
Collaboration diagram for GlassVersion:Private Member Functions | |
| void | serialise_stats () |
| void | unserialise_stats () |
Private Attributes | |
| glass_revision_number_t | rev |
| RootInfo | root [Glass::MAX_] |
| RootInfo | old_root [Glass::MAX_] |
| Uuid | uuid |
| The UUID of this database. More... | |
| int | fd |
| File descriptor. More... | |
| off_t | offset |
| Offset into the file at which the version data starts. More... | |
| std::string | db_dir |
| The database directory. More... | |
| GlassChanges * | changes |
| Xapian::doccount | doccount |
| The number of documents in the database. More... | |
| Xapian::totallength | total_doclen |
| The total of the lengths of all documents in the database. More... | |
| Xapian::docid | last_docid |
| Greatest document id ever used in this database. More... | |
| Xapian::termcount | doclen_lbound |
| A lower bound on the smallest document length in this database. More... | |
| Xapian::termcount | doclen_ubound |
| An upper bound on the greatest document length in this database. More... | |
| Xapian::termcount | wdf_ubound |
| An upper bound on the greatest wdf in this database. More... | |
| Xapian::termcount | spelling_wordfreq_ubound |
| An upper bound on the spelling wordfreq in this database. More... | |
| glass_revision_number_t | oldest_changeset |
| Oldest changeset removed when max_changesets is set. More... | |
| std::string | serialised_stats |
| The serialised database stats. More... | |
The GlassVersion class manages the revision files.
The "iamglass" file (currently) contains a "magic" string identifying that this is a glass 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 94 of file glass_version.h.
|
inlineexplicit |
Definition at line 158 of file glass_version.h.
|
explicit |
Definition at line 72 of file glass_version.cc.
References fd, offset, rare, and Xapian::Internal::str().
| GlassVersion::~GlassVersion | ( | ) |
Definition at line 87 of file glass_version.cc.
|
inline |
Definition at line 241 of file glass_version.h.
References doccount, doclen_lbound, doclen_ubound, min_non_zero(), and total_doclen.
Referenced by GlassWritableDatabase::add_document_(), and GlassWritableDatabase::replace_document().
| void GlassVersion::cancel | ( | ) |
Definition at line 261 of file glass_version.cc.
References LOGCALL_VOID, Glass::MAX_, old_root, root, and unserialise_stats().
Referenced by GlassDatabase::cancel().
|
inline |
Definition at line 260 of file glass_version.h.
References wdf_ubound.
Referenced by GlassWritableDatabase::add_document_(), and GlassWritableDatabase::replace_document().
| void GlassVersion::create | ( | unsigned | blocksize | ) |
Create the version file.
Definition at line 397 of file glass_version.cc.
References AssertRel, compress_min_tab, Uuid::generate(), Glass::RootInfo::init(), Glass::MAX_, root, and uuid.
Referenced by GlassDatabase::create_and_open_tables().
|
inline |
Definition at line 248 of file glass_version.h.
References doccount, doclen_lbound, doclen_ubound, total_doclen, and wdf_ubound.
Referenced by GlassWritableDatabase::delete_document(), and GlassWritableDatabase::replace_document().
|
inline |
Definition at line 207 of file glass_version.h.
References doccount.
Referenced by check_db_dir(), check_db_fd(), check_glass_table(), GlassDatabase::get_doccount(), GlassDatabase::get_used_docid_range(), and merge_stats().
|
inline |
Definition at line 213 of file glass_version.h.
References doclen_lbound.
Referenced by check_glass_table(), GlassDatabase::get_doclength_lower_bound(), and merge_stats().
|
inline |
Definition at line 217 of file glass_version.h.
References doclen_ubound.
Referenced by check_glass_table(), GlassDatabase::get_doclength_upper_bound(), and merge_stats().
|
inline |
Definition at line 211 of file glass_version.h.
References last_docid.
Referenced by GlassWritableDatabase::add_document(), check_db_dir(), check_db_fd(), check_glass_table(), GlassDatabase::get_lastdocid(), GlassDatabase::get_used_docid_range(), GlassDatabase::open_post_list(), GlassWritableDatabase::open_post_list(), and GlassWritableDatabase::replace_document().
|
inline |
Definition at line 264 of file glass_version.h.
References last_docid.
Referenced by GlassWritableDatabase::add_document().
|
inline |
Definition at line 274 of file glass_version.h.
References offset.
Referenced by check_db_fd(), and main().
|
inline |
Definition at line 227 of file glass_version.h.
References oldest_changeset.
Referenced by GlassDatabase::open_tables().
|
inline |
Definition at line 187 of file glass_version.h.
References rev.
Referenced by GlassDatabaseReplicator::apply_changeset_from_conn(), GlassDatabase::cancel(), GlassTableCheck::check(), check_db_dir(), GlassDatabase::create_and_open_tables(), GlassDatabase::get_next_revision_number(), GlassDatabase::get_revision_number(), main(), GlassDatabase::modifications_failed(), GlassDatabase::open_tables(), and GlassDatabase::set_revision_number().
|
inline |
Definition at line 189 of file glass_version.h.
References root.
Referenced by GlassDatabase::cancel(), GlassTableCheck::check(), GlassDatabase::create_and_open_tables(), main(), GlassDatabase::modifications_failed(), and GlassDatabase::open_tables().
|
inline |
Definition at line 223 of file glass_version.h.
References spelling_wordfreq_ubound.
Referenced by GlassDatabase::cancel(), merge_stats(), and GlassDatabase::open_tables().
|
inline |
Definition at line 209 of file glass_version.h.
References total_doclen.
Referenced by GlassDatabase::get_total_length(), and merge_stats().
|
inline |
Return pointer to 16 byte UUID.
Definition at line 198 of file glass_version.h.
References Uuid::data(), and uuid.
|
inline |
Return UUID in the standard 36 character string format.
Definition at line 203 of file glass_version.h.
References Uuid::to_string(), and uuid.
Referenced by GlassDatabase::get_uuid(), and GlassDatabaseReplicator::get_uuid().
|
inline |
Definition at line 221 of file glass_version.h.
References wdf_ubound.
Referenced by GlassDatabase::get_wdf_upper_bound(), and merge_stats().
| void GlassVersion::merge_stats | ( | const GlassVersion & | o | ) |
Merge the database stats.
Used by compaction.
Definition at line 236 of file glass_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_wdf_upper_bound(), spelling_wordfreq_ubound, total_doclen, and wdf_ubound.
| void GlassVersion::read | ( | ) |
Read the version file and check it's a version we understand.
On failure, an exception is thrown.
Definition at line 96 of file glass_version.cc.
References Uuid::assign(), Uuid::BINARY_SIZE, db_dir, fd, GLASS_FORMAT_VERSION, GLASS_VERSION_MAGIC, GLASS_VERSION_MAGIC_AND_VERSION_LEN, GLASS_VERSION_MAGIC_LEN, io_read(), LOGCALL_VOID, Glass::MAX_, O_BINARY, offset, old_root, 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 GlassDatabaseReplicator::apply_changeset_from_conn(), check_db_dir(), check_db_fd(), check_db_table(), GlassDatabaseReplicator::get_uuid(), main(), GlassDatabase::modifications_failed(), and GlassDatabase::open_tables().
|
inline |
Definition at line 193 of file glass_version.h.
References root.
Referenced by GlassDatabase::set_revision_number().
|
private |
Definition at line 174 of file glass_version.cc.
References doccount, doclen_lbound, doclen_ubound, last_docid, oldest_changeset, pack_uint(), serialised_stats, spelling_wordfreq_ubound, total_doclen, and wdf_ubound.
Referenced by write().
|
inline |
Definition at line 172 of file glass_version.h.
References changes.
Referenced by GlassDatabase::apply(), GlassDatabase::modifications_failed(), and GlassDatabase::open_tables().
|
inline |
Definition at line 231 of file glass_version.h.
References last_docid.
Referenced by GlassWritableDatabase::replace_document().
|
inline |
Definition at line 233 of file glass_version.h.
References oldest_changeset.
Referenced by GlassWritableDatabase::flush_postlist_changes().
|
inline |
Definition at line 237 of file glass_version.h.
References spelling_wordfreq_ubound.
Referenced by GlassDatabase::set_revision_number().
|
inline |
Definition at line 272 of file glass_version.h.
References db_dir.
Referenced by read(), GlassDatabase::single_file(), sync(), unserialise_stats(), and write().
| bool GlassVersion::sync | ( | const std::string & | tmpfile, |
| glass_revision_number_t | new_rev, | ||
| int | flags | ||
| ) |
Definition at line 327 of file glass_version.cc.
References Assert, close(), db_dir, Xapian::DB_FULL_SYNC, Xapian::DB_NO_SYNC, fd, io_full_sync(), io_sync(), io_tmp_rename(), Glass::MAX_, old_root, rev, root, and single_file().
Referenced by GlassDatabase::create_and_open_tables(), and GlassDatabase::set_revision_number().
|
private |
Definition at line 192 of file glass_version.cc.
References doccount, doclen_lbound, doclen_ubound, last_docid, oldest_changeset, serialised_stats, single_file(), spelling_wordfreq_ubound, total_doclen, unpack_uint(), and wdf_ubound.
| const string GlassVersion::write | ( | glass_revision_number_t | new_rev, |
| int | flags | ||
| ) |
Definition at line 271 of file glass_version.cc.
References Uuid::BINARY_SIZE, changes, close(), Uuid::data(), Xapian::DB_DANGEROUS, db_dir, fd, GLASS_VERSION_MAGIC, GLASS_VERSION_MAGIC_AND_VERSION_LEN, io_write(), LOGCALL, Glass::MAX_, O_BINARY, pack_uint(), posixy_open, rare, RETURN, root, Glass::RootInfo::serialise(), serialise_stats(), serialised_stats, single_file(), uuid, and GlassChanges::write_block().
Referenced by GlassDatabase::create_and_open_tables(), and GlassDatabase::set_revision_number().
|
private |
Definition at line 122 of file glass_version.h.
Referenced by set_changes(), and write().
|
private |
The database directory.
Definition at line 120 of file glass_version.h.
Referenced by check_glass_table(), read(), single_file(), sync(), and write().
|
private |
The number of documents in the database.
Definition at line 125 of file glass_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 134 of file glass_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 137 of file glass_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 111 of file glass_version.h.
Referenced by check_glass_table(), GlassVersion(), read(), sync(), write(), and ~GlassVersion().
|
private |
Greatest document id ever used in this database.
Definition at line 131 of file glass_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 117 of file glass_version.h.
Referenced by get_offset(), GlassVersion(), and read().
|
private |
Definition at line 98 of file glass_version.h.
|
mutableprivate |
Oldest changeset removed when max_changesets is set.
Definition at line 146 of file glass_version.h.
Referenced by get_oldest_changeset(), serialise_stats(), set_oldest_changeset(), and unserialise_stats().
|
private |
Definition at line 95 of file glass_version.h.
Referenced by get_revision(), read(), and sync().
|
private |
Definition at line 97 of file glass_version.h.
Referenced by cancel(), create(), get_root(), read(), root_to_set(), sync(), and write().
|
private |
The serialised database stats.
Definition at line 149 of file glass_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 143 of file glass_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 128 of file glass_version.h.
Referenced by add_document(), delete_document(), get_total_doclen(), merge_stats(), serialise_stats(), and unserialise_stats().
|
private |
The UUID of this database.
Definition at line 101 of file glass_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 140 of file glass_version.h.
Referenced by check_wdf(), delete_document(), get_wdf_upper_bound(), merge_stats(), serialise_stats(), and unserialise_stats().