#include <chert_database.h>


Public Member Functions | |
| ChertDatabase (const string &db_dir_, int action=XAPIAN_DB_READONLY, unsigned int block_size=0u) | |
| Create and open a chert database. | |
| ~ChertDatabase () | |
| ChertCursor * | get_postlist_cursor () const |
| Get a postlist table cursor (used by ChertValueList). | |
| XAPIAN_NORETURN (void throw_termlist_table_close_exception() const) | |
| Xapian::doccount | get_doccount () const |
| Virtual methods of Database::Internal. | |
| Xapian::docid | get_lastdocid () const |
| Virtual methods of Database::Internal. | |
| totlen_t | get_total_length () const |
| Virtual methods of Database::Internal. | |
| Xapian::doclength | get_avlength () const |
| Virtual methods of Database::Internal. | |
| Xapian::termcount | get_doclength (Xapian::docid did) const |
| Virtual methods of Database::Internal. | |
| Xapian::doccount | get_termfreq (const string &tname) const |
| Virtual methods of Database::Internal. | |
| Xapian::termcount | get_collection_freq (const string &tname) const |
| Virtual methods of Database::Internal. | |
| Xapian::doccount | get_value_freq (Xapian::valueno slot) const |
| Virtual methods of Database::Internal. | |
| std::string | get_value_lower_bound (Xapian::valueno slot) const |
| Virtual methods of Database::Internal. | |
| std::string | get_value_upper_bound (Xapian::valueno slot) const |
| Virtual methods of Database::Internal. | |
| Xapian::termcount | get_doclength_lower_bound () const |
| Virtual methods of Database::Internal. | |
| Xapian::termcount | get_doclength_upper_bound () const |
| Virtual methods of Database::Internal. | |
| Xapian::termcount | get_wdf_upper_bound (const string &term) const |
| Virtual methods of Database::Internal. | |
| bool | term_exists (const string &tname) const |
| Virtual methods of Database::Internal. | |
| bool | has_positions () const |
| Virtual methods of Database::Internal. | |
| LeafPostList * | open_post_list (const string &tname) const |
| Virtual methods of Database::Internal. | |
| ValueList * | open_value_list (Xapian::valueno slot) const |
| Virtual methods of Database::Internal. | |
| Xapian::Document::Internal * | open_document (Xapian::docid did, bool lazy) const |
| Virtual methods of Database::Internal. | |
| PositionList * | open_position_list (Xapian::docid did, const string &term) const |
| Virtual methods of Database::Internal. | |
| TermList * | open_term_list (Xapian::docid did) const |
| Virtual methods of Database::Internal. | |
| TermList * | open_allterms (const string &prefix) const |
| Virtual methods of Database::Internal. | |
| TermList * | open_spelling_termlist (const string &word) const |
| Virtual methods of Database::Internal. | |
| TermList * | open_spelling_wordlist () const |
| Virtual methods of Database::Internal. | |
| Xapian::doccount | get_spelling_frequency (const string &word) const |
| Virtual methods of Database::Internal. | |
| TermList * | open_synonym_termlist (const string &term) const |
| Virtual methods of Database::Internal. | |
| TermList * | open_synonym_keylist (const string &prefix) const |
| Virtual methods of Database::Internal. | |
| string | get_metadata (const string &key) const |
| Virtual methods of Database::Internal. | |
| TermList * | open_metadata_keylist (const std::string &prefix) const |
| Virtual methods of Database::Internal. | |
| void | write_changesets_to_fd (int fd, const string &start_revision, bool need_whole_db, Xapian::ReplicationInfo *info) |
| Virtual methods of Database::Internal. | |
| string | get_revision_info () const |
| Virtual methods of Database::Internal. | |
| string | get_uuid () const |
| Virtual methods of Database::Internal. | |
Private Member Functions | |
| bool | database_exists () |
| Return true if a database exists at the path specified for this database. | |
| void | create_and_open_tables (unsigned int blocksize) |
| Create new tables, and open them. | |
| void | open_tables_consistent () |
| Open all tables at most recent consistent revision. | |
| void | get_database_write_lock (bool creating) |
| Get a write lock on the database, or throw an Xapian::DatabaseLockError if failure. | |
| void | open_tables (chert_revision_number_t revision) |
| Open tables at specified revision number. | |
| chert_revision_number_t | get_revision_number () const |
| Get an object holding the revision number which the tables are opened at. | |
| chert_revision_number_t | get_next_revision_number () const |
| Get an object holding the next revision number which should be used in the tables. | |
| void | set_revision_number (chert_revision_number_t new_revision) |
| Set the revision number in the tables. | |
| void | reopen () |
| Re-open tables to recover from an overwritten condition, or just get most up-to-date version. | |
| void | close () |
| Close all the tables permanently. | |
| void | modifications_failed (chert_revision_number_t old_revision, chert_revision_number_t new_revision, const std::string &msg) |
| Called if a modifications fail. | |
| void | apply () |
| Apply any outstanding changes to the tables. | |
| void | cancel () |
| Cancel any outstanding changes to the tables. | |
| void | send_whole_database (RemoteConnection &conn, double end_time) |
| Send a set of messages which transfer the whole database. | |
| void | get_changeset_revisions (const string &path, chert_revision_number_t *startrev, chert_revision_number_t *endrev) const |
| Get the revision stored in a changeset. | |
Private Attributes | |
| std::string | db_dir |
| Directory to store databases in. | |
| bool | readonly |
| Whether the database is readonly. | |
| ChertVersion | version_file |
| The file describing the Chert database. | |
| ChertPostListTable | postlist_table |
| Table storing posting lists. | |
| ChertPositionListTable | position_table |
| Table storing position lists. | |
| ChertTermListTable | termlist_table |
| Table storing term lists. | |
| ChertValueManager | value_manager |
| Value manager. | |
| ChertSynonymTable | synonym_table |
| Table storing synonym data. | |
| ChertSpellingTable | spelling_table |
| Table storing spelling correction data. | |
| ChertRecordTable | record_table |
| Table storing records. | |
| FlintLock | lock |
| Lock object. | |
| unsigned int | max_changesets |
| The maximum number of changesets which should be kept in the database. | |
| ChertDatabaseStats | stats |
| Database statistics. | |
Friends | |
| class | ChertWritableDatabase |
| class | ChertTermList |
| class | ChertPostList |
| class | ChertAllTermsList |
| class | ChertAllDocsPostList |
Definition at line 52 of file chert_database.h.
| ChertDatabase::ChertDatabase | ( | const string & | db_dir_, | |
| int | action = XAPIAN_DB_READONLY, |
|||
| unsigned int | block_size = 0u | |||
| ) |
Create and open a chert database.
| Xapian::DatabaseCorruptError | is thrown if there is no consistent revision available. | |
| Xapian::DatabaseOpeningError | thrown if database can't be opened. | |
| Xapian::DatabaseVersionError | thrown if database is in an unsupported format. This implies that the database was created by an older or newer version of Xapian. |
| dbdir | directory holding chert tables | |
| block_size | Block size, in bytes, to use when creating tables. This is only important, and has the correct value, when the database is being created. |
Definition at line 105 of file chert_database.cc.
References create_and_open_tables(), database_exists(), Xapian::DB_CREATE, Xapian::DB_CREATE_OR_OVERWRITE, db_dir, Xapian::DB_OPEN, get_database_write_lock(), ChertTable::get_latest_revision_number(), get_next_revision_number(), ChertTable::get_open_revision_number(), LOGCALL_CTOR, mkdir(), open_tables_consistent(), postlist_table, record_table, S_ISDIR, set_revision_number(), stat(), and XAPIAN_DB_READONLY.
| ChertDatabase::~ChertDatabase | ( | ) |
| void ChertDatabase::apply | ( | ) | [private] |
Apply any outstanding changes to the tables.
If an error occurs during this operation, this will be signalled by an exception being thrown. In this case the contents of the tables on disk will be left in an unmodified state (though possibly with increased revision numbers), and the outstanding changes will be lost.
Reimplemented in ChertWritableDatabase.
Definition at line 718 of file chert_database.cc.
References Xapian::Error::get_description(), get_next_revision_number(), get_revision_number(), ChertSpellingTable::is_modified(), ChertSynonymTable::is_modified(), ChertValueManager::is_modified(), ChertTable::is_modified(), LOGCALL_VOID, modifications_failed(), position_table, postlist_table, record_table, set_revision_number(), spelling_table, synonym_table, termlist_table, and value_manager.
| void ChertDatabase::cancel | ( | ) | [private, virtual] |
Cancel any outstanding changes to the tables.
Reimplemented from Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 746 of file chert_database.cc.
References ChertSpellingTable::cancel(), ChertSynonymTable::cancel(), ChertValueManager::cancel(), ChertTable::cancel(), LOGCALL_VOID, position_table, postlist_table, record_table, spelling_table, synonym_table, termlist_table, and value_manager.
Referenced by modifications_failed().
| void ChertDatabase::close | ( | ) | [private, virtual] |
Close all the tables permanently.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 488 of file chert_database.cc.
References ChertTable::close(), lock, LOGCALL_VOID, position_table, postlist_table, record_table, FlintLock::release(), spelling_table, synonym_table, and termlist_table.
Referenced by modifications_failed().
| void ChertDatabase::create_and_open_tables | ( | unsigned int | blocksize | ) | [private] |
Create new tables, and open them.
Any existing tables will be removed first.
Definition at line 187 of file chert_database.cc.
References Assert, ChertVersion::create(), ChertTermListTable::create_and_open(), ChertLazyTable::create_and_open(), ChertTable::create_and_open(), database_exists(), ChertTable::get_open_revision_number(), LOGCALL_VOID, position_table, postlist_table, record_table, Xapian::revision(), spelling_table, stats, synonym_table, termlist_table, version_file, and ChertDatabaseStats::zero().
Referenced by ChertDatabase().
| bool ChertDatabase::database_exists | ( | ) | [private] |
Return true if a database exists at the path specified for this database.
Definition at line 181 of file chert_database.cc.
References ChertTable::exists(), LOGCALL, postlist_table, record_table, and RETURN.
Referenced by ChertDatabase(), create_and_open_tables(), and get_database_write_lock().
| Xapian::doclength ChertDatabase::get_avlength | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 780 of file chert_database.cc.
References ChertRecordTable::get_doccount(), ChertDatabaseStats::get_total_doclen(), LOGCALL, record_table, RETURN, and stats.
| void ChertDatabase::get_changeset_revisions | ( | const string & | path, | |
| chert_revision_number_t * | startrev, | |||
| chert_revision_number_t * | endrev | |||
| ) | const [private] |
Get the revision stored in a changeset.
Definition at line 336 of file chert_database.cc.
References CHANGES_MAGIC_STRING, CHANGES_VERSION, CONST_STRLEN, io_read(), msvc_posix_open(), O_BINARY, Xapian::InMemory::open(), REASONABLE_CHANGESET_SIZE, and unpack_uint().
Referenced by write_changesets_to_fd().
| Xapian::termcount ChertDatabase::get_collection_freq | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 809 of file chert_database.cc.
References Assert, ChertPostListTable::get_collection_freq(), LOGCALL, postlist_table, and RETURN.
Referenced by get_wdf_upper_bound().
| void ChertDatabase::get_database_write_lock | ( | bool | creating | ) | [private] |
Get a write lock on the database, or throw an Xapian::DatabaseLockError if failure.
| creating | true if the database is in the process of being created - if false, will throw a DatabaseOpening error if the lock can't be acquired and the database doesn't exist. |
Definition at line 501 of file chert_database.cc.
References database_exists(), db_dir, FlintLock::lock(), lock, LOGCALL_VOID, FlintLock::SUCCESS, and FlintLock::UNKNOWN.
Referenced by ChertDatabase().
| Xapian::doccount ChertDatabase::get_doccount | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 759 of file chert_database.cc.
References ChertRecordTable::get_doccount(), LOGCALL, record_table, and RETURN.
Referenced by ChertWritableDatabase::open_post_list(), and open_post_list().
| Xapian::termcount ChertDatabase::get_doclength | ( | Xapian::docid | did | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 792 of file chert_database.cc.
References Assert, ChertPostListTable::get_doclength(), LOGCALL, postlist_table, and RETURN.
Referenced by ChertWritableDatabase::get_doclength(), and open_document().
| Xapian::termcount ChertDatabase::get_doclength_lower_bound | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 838 of file chert_database.cc.
References ChertDatabaseStats::get_doclength_lower_bound(), and stats.
| Xapian::termcount ChertDatabase::get_doclength_upper_bound | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 844 of file chert_database.cc.
References ChertDatabaseStats::get_doclength_upper_bound(), and stats.
| Xapian::docid ChertDatabase::get_lastdocid | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 766 of file chert_database.cc.
References ChertDatabaseStats::get_last_docid(), LOGCALL, RETURN, and stats.
| string ChertDatabase::get_metadata | ( | const string & | key | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 979 of file chert_database.cc.
References ChertTable::get_exact_entry(), LOGCALL, postlist_table, and RETURN.
| chert_revision_number_t ChertDatabase::get_next_revision_number | ( | ) | const [private] |
Get an object holding the next revision number which should be used in the tables.
Definition at line 322 of file chert_database.cc.
References ChertTable::get_latest_revision_number(), LOGCALL, postlist_table, and RETURN.
Referenced by apply(), and ChertDatabase().
| ChertCursor* ChertDatabase::get_postlist_cursor | ( | ) | const [inline] |
Get a postlist table cursor (used by ChertValueList).
Definition at line 246 of file chert_database.h.
References ChertTable::cursor_get(), and postlist_table.
| string ChertDatabase::get_revision_info | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 1000 of file chert_database.cc.
References get_revision_number(), LOGCALL, pack_uint(), and RETURN.
| chert_revision_number_t ChertDatabase::get_revision_number | ( | ) | const [private] |
Get an object holding the revision number which the tables are opened at.
Definition at line 314 of file chert_database.cc.
References ChertTable::get_open_revision_number(), LOGCALL, postlist_table, and RETURN.
Referenced by apply(), get_revision_info(), send_whole_database(), set_revision_number(), and write_changesets_to_fd().
| Xapian::doccount ChertDatabase::get_spelling_frequency | ( | const string & | word | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 958 of file chert_database.cc.
References ChertSpellingTable::get_word_frequency(), and spelling_table.
| Xapian::doccount ChertDatabase::get_termfreq | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 801 of file chert_database.cc.
References Assert, ChertPostListTable::get_termfreq(), LOGCALL, postlist_table, and RETURN.
| totlen_t ChertDatabase::get_total_length | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 773 of file chert_database.cc.
References ChertDatabaseStats::get_total_doclen(), LOGCALL, RETURN, and stats.
| string ChertDatabase::get_uuid | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 1009 of file chert_database.cc.
References ChertVersion::get_uuid_string(), LOGCALL, RETURN, and version_file.
Referenced by send_whole_database(), and write_changesets_to_fd().
| Xapian::doccount ChertDatabase::get_value_freq | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 817 of file chert_database.cc.
References ChertValueManager::get_value_freq(), LOGCALL, RETURN, and value_manager.
Referenced by ChertWritableDatabase::get_value_freq().
| std::string ChertDatabase::get_value_lower_bound | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 824 of file chert_database.cc.
References ChertValueManager::get_value_lower_bound(), LOGCALL, RETURN, and value_manager.
Referenced by ChertWritableDatabase::get_value_lower_bound().
| std::string ChertDatabase::get_value_upper_bound | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 831 of file chert_database.cc.
References ChertValueManager::get_value_upper_bound(), LOGCALL, RETURN, and value_manager.
Referenced by ChertWritableDatabase::get_value_upper_bound().
| Xapian::termcount ChertDatabase::get_wdf_upper_bound | ( | const string & | term | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 850 of file chert_database.cc.
References get_collection_freq(), ChertDatabaseStats::get_wdf_upper_bound(), and stats.
| bool ChertDatabase::has_positions | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 864 of file chert_database.cc.
References ChertTable::empty(), and position_table.
| void ChertDatabase::modifications_failed | ( | chert_revision_number_t | old_revision, | |
| chert_revision_number_t | new_revision, | |||
| const std::string & | msg | |||
| ) | [private] |
Called if a modifications fail.
| msg | is a string description of the exception that was raised when the modifications failed. |
Definition at line 690 of file chert_database.cc.
References cancel(), close(), Xapian::Error::get_msg(), open_tables(), and set_revision_number().
Referenced by apply().
| TermList * ChertDatabase::open_allterms | ( | const string & | prefix | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 935 of file chert_database.cc.
References ChertAllTermsList, LOGCALL, and RETURN.
Referenced by ChertWritableDatabase::open_allterms().
| Xapian::Document::Internal * ChertDatabase::open_document | ( | Xapian::docid | did, | |
| bool | lazy | |||
| ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 906 of file chert_database.cc.
References Assert, get_doclength(), LOGCALL, record_table, RETURN, and value_manager.
| TermList * ChertDatabase::open_metadata_keylist | ( | const std::string & | prefix | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 990 of file chert_database.cc.
References ChertTable::cursor_get(), LOGCALL, and postlist_table.
| PositionList * ChertDatabase::open_position_list | ( | Xapian::docid | did, | |
| const string & | term | |||
| ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 920 of file chert_database.cc.
References Assert, and position_table.
| LeafPostList * ChertDatabase::open_post_list | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 870 of file chert_database.cc.
References ChertAllDocsPostList, ChertPostList, get_doccount(), ChertDatabaseStats::get_last_docid(), LOGCALL, RETURN, and stats.
| TermList * ChertDatabase::open_spelling_termlist | ( | const string & | word | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 943 of file chert_database.cc.
References ChertSpellingTable::open_termlist(), and spelling_table.
| TermList * ChertDatabase::open_spelling_wordlist | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 949 of file chert_database.cc.
References ChertTable::cursor_get(), and spelling_table.
| TermList * ChertDatabase::open_synonym_keylist | ( | const string & | prefix | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 970 of file chert_database.cc.
References ChertTable::cursor_get(), and synonym_table.
| TermList * ChertDatabase::open_synonym_termlist | ( | const string & | term | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 964 of file chert_database.cc.
References ChertSynonymTable::open_termlist(), and synonym_table.
| void ChertDatabase::open_tables | ( | chert_revision_number_t | revision | ) | [private] |
Open tables at specified revision number.
| Xapian::InvalidArgumentError | is thrown if the specified revision is not available. |
Definition at line 291 of file chert_database.cc.
References ChertTable::get_block_size(), LOGCALL_VOID, ChertPostListTable::open(), ChertTable::open(), position_table, postlist_table, ChertVersion::read_and_check(), record_table, ChertValueManager::reset(), ChertTable::set_block_size(), spelling_table, synonym_table, termlist_table, value_manager, and version_file.
Referenced by modifications_failed().
| void ChertDatabase::open_tables_consistent | ( | ) | [private] |
Open all tables at most recent consistent revision.
| Xapian::DatabaseCorruptError | is thrown if there is no consistent revision available. |
Definition at line 215 of file chert_database.cc.
References ChertTable::get_block_size(), ChertTable::get_open_revision_number(), LOGCALL_VOID, MAX_OPEN_RETRIES, ChertPostListTable::open(), ChertTable::open(), position_table, postlist_table, ChertDatabaseStats::read(), ChertVersion::read_and_check(), record_table, ChertValueManager::reset(), Xapian::revision(), ChertTable::set_block_size(), spelling_table, stats, synonym_table, termlist_table, value_manager, and version_file.
Referenced by ChertDatabase(), and reopen().
| TermList * ChertDatabase::open_term_list | ( | Xapian::docid | did | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 895 of file chert_database.cc.
References Assert, ChertTermList, ChertTable::is_open(), LOGCALL, RETURN, and termlist_table.
| ValueList * ChertDatabase::open_value_list | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 887 of file chert_database.cc.
References LOGCALL, and RETURN.
Referenced by ChertWritableDatabase::open_value_list().
| void ChertDatabase::reopen | ( | ) | [private, virtual] |
Re-open tables to recover from an overwritten condition, or just get most up-to-date version.
Reimplemented from Xapian::Database::Internal.
Definition at line 481 of file chert_database.cc.
References LOGCALL_VOID, open_tables_consistent(), and readonly.
Referenced by write_changesets_to_fd().
| void ChertDatabase::send_whole_database | ( | RemoteConnection & | conn, | |
| double | end_time | |||
| ) | [private] |
Send a set of messages which transfer the whole database.
Definition at line 518 of file chert_database.cc.
References db_dir, encode_length(), get_revision_number(), get_uuid(), LOGCALL_VOID, msvc_posix_open(), O_BINARY, Xapian::InMemory::open(), pack_uint(), REPL_REPLY_DB_FILEDATA, REPL_REPLY_DB_FILENAME, REPL_REPLY_DB_HEADER, RemoteConnection::send_file(), and RemoteConnection::send_message().
Referenced by write_changesets_to_fd().
| void ChertDatabase::set_revision_number | ( | chert_revision_number_t | new_revision | ) | [private] |
Set the revision number in the tables.
This updates the disk tables so that the currently open revision becomes the specified revision number.
| new_revision | The new revision number to store. This must be greater than the latest revision number (see get_latest_revision_number()), or undefined behaviour will result. |
Definition at line 386 of file chert_database.cc.
References CHANGES_MAGIC_STRING, CHANGES_VERSION, ChertTable::commit(), create_changeset_file(), db_dir, ChertSpellingTable::flush_db(), ChertSynonymTable::flush_db(), ChertTable::flush_db(), get_revision_number(), io_unlink(), io_write(), LOGCALL_VOID, max_changesets, ChertValueManager::merge_changes(), pack_uint(), position_table, postlist_table, record_table, spelling_table, Xapian::Internal::str(), synonym_table, termlist_table, value_manager, and ChertTable::write_changed_blocks().
Referenced by apply(), ChertDatabase(), and modifications_failed().
| bool ChertDatabase::term_exists | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in ChertWritableDatabase.
Definition at line 856 of file chert_database.cc.
References Assert, LOGCALL, postlist_table, and ChertPostListTable::term_exists().
| void ChertDatabase::write_changesets_to_fd | ( | int | fd, | |
| const string & | start_revision, | |||
| bool | need_whole_db, | |||
| Xapian::ReplicationInfo * | info | |||
| ) | [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 559 of file chert_database.cc.
References Xapian::ReplicationInfo::changed, Xapian::ReplicationInfo::changeset_count, db_dir, Xapian::ReplicationInfo::fullcopy_count, get_changeset_revisions(), get_revision_number(), get_uuid(), LOGCALL_VOID, MAX_DB_COPIES_PER_CONVERSATION, msvc_posix_open(), O_BINARY, Xapian::InMemory::open(), pack_uint(), reopen(), REPL_REPLY_CHANGESET, REPL_REPLY_DB_FOOTER, REPL_REPLY_END_OF_CHANGES, REPL_REPLY_FAIL, RemoteConnection::send_file(), RemoteConnection::send_message(), send_whole_database(), Xapian::Internal::str(), and unpack_uint().
| ChertDatabase::XAPIAN_NORETURN | ( | void throw_termlist_table_close_exception() | const | ) |
friend class ChertAllDocsPostList [friend] |
Definition at line 57 of file chert_database.h.
Referenced by ChertWritableDatabase::open_post_list(), and open_post_list().
friend class ChertAllTermsList [friend] |
friend class ChertPostList [friend] |
Definition at line 55 of file chert_database.h.
Referenced by ChertWritableDatabase::open_post_list(), and open_post_list().
friend class ChertTermList [friend] |
friend class ChertWritableDatabase [friend] |
Definition at line 53 of file chert_database.h.
std::string ChertDatabase::db_dir [private] |
Directory to store databases in.
Definition at line 61 of file chert_database.h.
Referenced by ChertDatabase(), get_database_write_lock(), send_whole_database(), set_revision_number(), and write_changesets_to_fd().
FlintLock ChertDatabase::lock [private] |
Lock object.
Definition at line 111 of file chert_database.h.
Referenced by close(), and get_database_write_lock().
unsigned int ChertDatabase::max_changesets [private] |
The maximum number of changesets which should be kept in the database.
Definition at line 115 of file chert_database.h.
Referenced by set_revision_number().
Table storing position lists.
Definition at line 83 of file chert_database.h.
Referenced by ChertWritableDatabase::add_document_(), apply(), cancel(), close(), create_and_open_tables(), ChertWritableDatabase::delete_document(), has_positions(), open_position_list(), open_tables(), open_tables_consistent(), ChertWritableDatabase::replace_document(), and set_revision_number().
ChertPostListTable ChertDatabase::postlist_table [mutable, private] |
Table storing posting lists.
Whenever an update is performed, this table is the first to be updated: therefore, its most recent revision number is the most recent anywhere in the database.
Definition at line 79 of file chert_database.h.
Referenced by apply(), ChertWritableDatabase::cancel(), cancel(), ChertDatabase(), close(), create_and_open_tables(), database_exists(), ChertWritableDatabase::flush_postlist_changes(), get_collection_freq(), get_doclength(), get_metadata(), get_next_revision_number(), get_postlist_cursor(), get_revision_number(), get_termfreq(), open_metadata_keylist(), open_tables(), open_tables_consistent(), ChertWritableDatabase::replace_document(), ChertWritableDatabase::set_metadata(), set_revision_number(), and term_exists().
bool ChertDatabase::readonly [private] |
Whether the database is readonly.
Definition at line 65 of file chert_database.h.
Referenced by reopen().
ChertRecordTable ChertDatabase::record_table [private] |
Table storing records.
Whenever an update is performed, this table is the last to be updated: therefore, its most recent revision number is the most recent consistent revision available. If this table's most recent revision number is not available for all tables, there is no consistent revision available, and the database is corrupt.
Definition at line 108 of file chert_database.h.
Referenced by ChertWritableDatabase::add_document_(), apply(), cancel(), ChertDatabase(), close(), create_and_open_tables(), database_exists(), ChertWritableDatabase::delete_document(), get_avlength(), get_doccount(), open_document(), open_tables(), open_tables_consistent(), ChertWritableDatabase::replace_document(), and set_revision_number().
ChertSpellingTable ChertDatabase::spelling_table [mutable, private] |
Table storing spelling correction data.
Definition at line 98 of file chert_database.h.
Referenced by ChertWritableDatabase::add_spelling(), apply(), cancel(), close(), create_and_open_tables(), get_spelling_frequency(), open_spelling_termlist(), ChertWritableDatabase::open_spelling_wordlist(), open_spelling_wordlist(), open_tables(), open_tables_consistent(), ChertWritableDatabase::remove_spelling(), and set_revision_number().
ChertDatabaseStats ChertDatabase::stats [private] |
Database statistics.
Definition at line 118 of file chert_database.h.
Referenced by ChertWritableDatabase::add_document(), ChertWritableDatabase::add_document_(), ChertWritableDatabase::cancel(), create_and_open_tables(), ChertWritableDatabase::delete_document(), ChertWritableDatabase::flush_postlist_changes(), get_avlength(), get_doclength_lower_bound(), get_doclength_upper_bound(), get_lastdocid(), get_total_length(), get_wdf_upper_bound(), ChertWritableDatabase::open_post_list(), open_post_list(), open_tables_consistent(), and ChertWritableDatabase::replace_document().
ChertSynonymTable ChertDatabase::synonym_table [mutable, private] |
Table storing synonym data.
Definition at line 94 of file chert_database.h.
Referenced by ChertWritableDatabase::add_synonym(), apply(), cancel(), ChertWritableDatabase::clear_synonyms(), close(), create_and_open_tables(), ChertWritableDatabase::open_synonym_keylist(), open_synonym_keylist(), open_synonym_termlist(), open_tables(), open_tables_consistent(), ChertWritableDatabase::remove_synonym(), and set_revision_number().
Table storing term lists.
Definition at line 87 of file chert_database.h.
Referenced by ChertWritableDatabase::add_document_(), apply(), cancel(), close(), create_and_open_tables(), ChertWritableDatabase::delete_document(), open_tables(), open_tables_consistent(), open_term_list(), ChertWritableDatabase::replace_document(), and set_revision_number().
ChertValueManager ChertDatabase::value_manager [mutable, private] |
Value manager.
Definition at line 90 of file chert_database.h.
Referenced by ChertWritableDatabase::add_document_(), ChertWritableDatabase::apply(), apply(), cancel(), ChertWritableDatabase::delete_document(), get_value_freq(), get_value_lower_bound(), get_value_upper_bound(), open_document(), open_tables(), open_tables_consistent(), ChertWritableDatabase::open_value_list(), ChertWritableDatabase::replace_document(), and set_revision_number().
ChertVersion ChertDatabase::version_file [private] |
The file describing the Chert database.
This file has information about the format of the database which can't easily be stored in any of the individual tables.
Definition at line 71 of file chert_database.h.
Referenced by create_and_open_tables(), get_uuid(), open_tables(), and open_tables_consistent().