#include <brass_database.h>


Public Member Functions | |
| BrassDatabase (const string &db_dir_, int action=XAPIAN_DB_READONLY, unsigned int block_size=0u) | |
| Create and open a brass database. | |
| ~BrassDatabase () | |
| BrassCursor * | get_postlist_cursor () const |
| Get a postlist table cursor (used by BrassValueList). | |
| 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 (brass_revision_number_t revision) |
| Open tables at specified revision number. | |
| brass_revision_number_t | get_revision_number () const |
| Get an object holding the revision number which the tables are opened at. | |
| brass_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 (brass_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 (brass_revision_number_t old_revision, brass_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, brass_revision_number_t *startrev, brass_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. | |
| BrassVersion | version_file |
| The file describing the Brass database. | |
| BrassPostListTable | postlist_table |
| Table storing posting lists. | |
| BrassPositionListTable | position_table |
| Table storing position lists. | |
| BrassTermListTable | termlist_table |
| Table storing term lists. | |
| BrassValueManager | value_manager |
| Value manager. | |
| BrassSynonymTable | synonym_table |
| Table storing synonym data. | |
| BrassSpellingTable | spelling_table |
| Table storing spelling correction data. | |
| BrassRecordTable | 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. | |
| BrassDatabaseStats | stats |
| Database statistics. | |
Friends | |
| class | BrassWritableDatabase |
| class | BrassTermList |
| class | BrassPostList |
| class | BrassAllTermsList |
| class | BrassAllDocsPostList |
Definition at line 53 of file brass_database.h.
| BrassDatabase::BrassDatabase | ( | const string & | db_dir_, | |
| int | action = XAPIAN_DB_READONLY, |
|||
| unsigned int | block_size = 0u | |||
| ) |
Create and open a brass 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 brass 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 102 of file brass_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(), BrassTable::get_latest_revision_number(), get_next_revision_number(), BrassTable::get_open_revision_number(), LOGCALL_CTOR, mkdir(), open_tables_consistent(), postlist_table, record_table, S_ISDIR, set_revision_number(), stat(), and XAPIAN_DB_READONLY.
| BrassDatabase::~BrassDatabase | ( | ) |
| void BrassDatabase::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 BrassWritableDatabase.
Definition at line 735 of file brass_database.cc.
References Xapian::Error::get_description(), get_next_revision_number(), get_revision_number(), BrassSpellingTable::is_modified(), BrassSynonymTable::is_modified(), BrassValueManager::is_modified(), BrassTable::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 BrassDatabase::cancel | ( | ) | [private, virtual] |
Cancel any outstanding changes to the tables.
Reimplemented from Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 763 of file brass_database.cc.
References BrassSpellingTable::cancel(), BrassSynonymTable::cancel(), BrassValueManager::cancel(), BrassTable::cancel(), LOGCALL_VOID, position_table, postlist_table, record_table, spelling_table, synonym_table, termlist_table, and value_manager.
Referenced by modifications_failed().
| void BrassDatabase::close | ( | ) | [private, virtual] |
Close all the tables permanently.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 505 of file brass_database.cc.
References BrassTable::close(), lock, LOGCALL_VOID, position_table, postlist_table, record_table, FlintLock::release(), spelling_table, synonym_table, and termlist_table.
Referenced by modifications_failed().
| void BrassDatabase::create_and_open_tables | ( | unsigned int | blocksize | ) | [private] |
Create new tables, and open them.
Any existing tables will be removed first.
Definition at line 184 of file brass_database.cc.
References Assert, BrassVersion::create(), BrassTermListTable::create_and_open(), BrassLazyTable::create_and_open(), BrassTable::create_and_open(), database_exists(), BrassTable::get_open_revision_number(), LOGCALL_VOID, position_table, postlist_table, record_table, Xapian::revision(), spelling_table, stats, synonym_table, termlist_table, version_file, and BrassDatabaseStats::zero().
Referenced by BrassDatabase().
| bool BrassDatabase::database_exists | ( | ) | [private] |
Return true if a database exists at the path specified for this database.
Definition at line 178 of file brass_database.cc.
References BrassTable::exists(), LOGCALL, postlist_table, record_table, and RETURN.
Referenced by BrassDatabase(), create_and_open_tables(), and get_database_write_lock().
| Xapian::doclength BrassDatabase::get_avlength | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 797 of file brass_database.cc.
References BrassRecordTable::get_doccount(), BrassDatabaseStats::get_total_doclen(), LOGCALL, record_table, RETURN, and stats.
| void BrassDatabase::get_changeset_revisions | ( | const string & | path, | |
| brass_revision_number_t * | startrev, | |||
| brass_revision_number_t * | endrev | |||
| ) | const [private] |
Get the revision stored in a changeset.
Definition at line 333 of file brass_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 BrassDatabase::get_collection_freq | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 826 of file brass_database.cc.
References Assert, BrassPostListTable::get_collection_freq(), LOGCALL, postlist_table, and RETURN.
Referenced by BrassWritableDatabase::get_collection_freq(), and get_wdf_upper_bound().
| void BrassDatabase::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 518 of file brass_database.cc.
References database_exists(), db_dir, FlintLock::lock(), lock, LOGCALL_VOID, FlintLock::SUCCESS, and FlintLock::UNKNOWN.
Referenced by BrassDatabase().
| Xapian::doccount BrassDatabase::get_doccount | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 776 of file brass_database.cc.
References BrassRecordTable::get_doccount(), LOGCALL, record_table, and RETURN.
Referenced by BrassWritableDatabase::open_post_list(), and open_post_list().
| Xapian::termcount BrassDatabase::get_doclength | ( | Xapian::docid | did | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 809 of file brass_database.cc.
References Assert, BrassPostListTable::get_doclength(), LOGCALL, postlist_table, and RETURN.
Referenced by BrassWritableDatabase::get_doclength(), and open_document().
| Xapian::termcount BrassDatabase::get_doclength_lower_bound | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 855 of file brass_database.cc.
References BrassDatabaseStats::get_doclength_lower_bound(), and stats.
| Xapian::termcount BrassDatabase::get_doclength_upper_bound | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 861 of file brass_database.cc.
References BrassDatabaseStats::get_doclength_upper_bound(), and stats.
| Xapian::docid BrassDatabase::get_lastdocid | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 783 of file brass_database.cc.
References BrassDatabaseStats::get_last_docid(), LOGCALL, RETURN, and stats.
| string BrassDatabase::get_metadata | ( | const string & | key | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 996 of file brass_database.cc.
References BrassTable::get_exact_entry(), LOGCALL, postlist_table, and RETURN.
| brass_revision_number_t BrassDatabase::get_next_revision_number | ( | ) | const [private] |
Get an object holding the next revision number which should be used in the tables.
Definition at line 319 of file brass_database.cc.
References BrassTable::get_latest_revision_number(), LOGCALL, postlist_table, and RETURN.
Referenced by apply(), and BrassDatabase().
| BrassCursor* BrassDatabase::get_postlist_cursor | ( | ) | const [inline] |
Get a postlist table cursor (used by BrassValueList).
Definition at line 248 of file brass_database.h.
References BrassTable::cursor_get(), and postlist_table.
| string BrassDatabase::get_revision_info | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 1017 of file brass_database.cc.
References get_revision_number(), LOGCALL, pack_uint(), and RETURN.
| brass_revision_number_t BrassDatabase::get_revision_number | ( | ) | const [private] |
Get an object holding the revision number which the tables are opened at.
Definition at line 311 of file brass_database.cc.
References BrassTable::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 BrassDatabase::get_spelling_frequency | ( | const string & | word | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 975 of file brass_database.cc.
References BrassSpellingTable::get_word_frequency(), and spelling_table.
| Xapian::doccount BrassDatabase::get_termfreq | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 818 of file brass_database.cc.
References Assert, BrassPostListTable::get_termfreq(), LOGCALL, postlist_table, and RETURN.
Referenced by BrassWritableDatabase::get_termfreq().
| totlen_t BrassDatabase::get_total_length | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 790 of file brass_database.cc.
References BrassDatabaseStats::get_total_doclen(), LOGCALL, RETURN, and stats.
| string BrassDatabase::get_uuid | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 1026 of file brass_database.cc.
References BrassVersion::get_uuid_string(), LOGCALL, RETURN, and version_file.
Referenced by send_whole_database(), and write_changesets_to_fd().
| Xapian::doccount BrassDatabase::get_value_freq | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 834 of file brass_database.cc.
References BrassValueManager::get_value_freq(), LOGCALL, RETURN, and value_manager.
Referenced by BrassWritableDatabase::get_value_freq().
| std::string BrassDatabase::get_value_lower_bound | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 841 of file brass_database.cc.
References BrassValueManager::get_value_lower_bound(), LOGCALL, RETURN, and value_manager.
Referenced by BrassWritableDatabase::get_value_lower_bound().
| std::string BrassDatabase::get_value_upper_bound | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 848 of file brass_database.cc.
References BrassValueManager::get_value_upper_bound(), LOGCALL, RETURN, and value_manager.
Referenced by BrassWritableDatabase::get_value_upper_bound().
| Xapian::termcount BrassDatabase::get_wdf_upper_bound | ( | const string & | term | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 867 of file brass_database.cc.
References get_collection_freq(), BrassDatabaseStats::get_wdf_upper_bound(), and stats.
| bool BrassDatabase::has_positions | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 881 of file brass_database.cc.
References BrassTable::empty(), and position_table.
| void BrassDatabase::modifications_failed | ( | brass_revision_number_t | old_revision, | |
| brass_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 707 of file brass_database.cc.
References cancel(), close(), Xapian::Error::get_msg(), open_tables(), and set_revision_number().
Referenced by apply().
| TermList * BrassDatabase::open_allterms | ( | const string & | prefix | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 952 of file brass_database.cc.
References BrassAllTermsList, LOGCALL, and RETURN.
Referenced by BrassWritableDatabase::open_allterms().
| Xapian::Document::Internal * BrassDatabase::open_document | ( | Xapian::docid | did, | |
| bool | lazy | |||
| ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 923 of file brass_database.cc.
References Assert, get_doclength(), LOGCALL, record_table, RETURN, and value_manager.
| TermList * BrassDatabase::open_metadata_keylist | ( | const std::string & | prefix | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 1007 of file brass_database.cc.
References BrassTable::cursor_get(), LOGCALL, and postlist_table.
| PositionList * BrassDatabase::open_position_list | ( | Xapian::docid | did, | |
| const string & | term | |||
| ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 937 of file brass_database.cc.
References Assert, and position_table.
| LeafPostList * BrassDatabase::open_post_list | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 887 of file brass_database.cc.
References BrassAllDocsPostList, BrassPostList, get_doccount(), BrassDatabaseStats::get_last_docid(), LOGCALL, RETURN, and stats.
| TermList * BrassDatabase::open_spelling_termlist | ( | const string & | word | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 960 of file brass_database.cc.
References BrassSpellingTable::open_termlist(), and spelling_table.
| TermList * BrassDatabase::open_spelling_wordlist | ( | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 966 of file brass_database.cc.
References BrassTable::cursor_get(), and spelling_table.
| TermList * BrassDatabase::open_synonym_keylist | ( | const string & | prefix | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 987 of file brass_database.cc.
References BrassTable::cursor_get(), and synonym_table.
| TermList * BrassDatabase::open_synonym_termlist | ( | const string & | term | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Definition at line 981 of file brass_database.cc.
References BrassSynonymTable::open_termlist(), and synonym_table.
| void BrassDatabase::open_tables | ( | brass_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 288 of file brass_database.cc.
References BrassTable::get_block_size(), LOGCALL_VOID, BrassPostListTable::open(), BrassTable::open(), position_table, postlist_table, BrassVersion::read_and_check(), record_table, BrassValueManager::reset(), BrassTable::set_block_size(), spelling_table, synonym_table, termlist_table, value_manager, and version_file.
Referenced by modifications_failed().
| void BrassDatabase::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 212 of file brass_database.cc.
References BrassTable::get_block_size(), BrassTable::get_open_revision_number(), LOGCALL_VOID, MAX_OPEN_RETRIES, BrassPostListTable::open(), BrassTable::open(), position_table, postlist_table, BrassDatabaseStats::read(), BrassVersion::read_and_check(), record_table, BrassValueManager::reset(), Xapian::revision(), BrassTable::set_block_size(), spelling_table, stats, synonym_table, termlist_table, value_manager, and version_file.
Referenced by BrassDatabase(), and reopen().
| TermList * BrassDatabase::open_term_list | ( | Xapian::docid | did | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Definition at line 912 of file brass_database.cc.
References Assert, BrassTermList, BrassTable::is_open(), LOGCALL, RETURN, and termlist_table.
| ValueList * BrassDatabase::open_value_list | ( | Xapian::valueno | slot | ) | const [virtual] |
Virtual methods of Database::Internal.
Reimplemented from Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 904 of file brass_database.cc.
References LOGCALL, and RETURN.
Referenced by BrassWritableDatabase::open_value_list().
| void BrassDatabase::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 498 of file brass_database.cc.
References LOGCALL_VOID, open_tables_consistent(), and readonly.
Referenced by write_changesets_to_fd().
| void BrassDatabase::send_whole_database | ( | RemoteConnection & | conn, | |
| double | end_time | |||
| ) | [private] |
Send a set of messages which transfer the whole database.
Definition at line 535 of file brass_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 BrassDatabase::set_revision_number | ( | brass_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 383 of file brass_database.cc.
References CHANGES_MAGIC_STRING, CHANGES_VERSION, BrassTable::commit(), db_dir, BrassSpellingTable::flush_db(), BrassSynonymTable::flush_db(), BrassTable::flush_db(), BrassDatabaseStats::get_oldest_changeset(), get_revision_number(), io_unlink(), io_write(), LOGCALL_VOID, LOGLINE, max_changesets, BrassValueManager::merge_changes(), msvc_posix_open(), O_BINARY, Xapian::InMemory::open(), pack_uint(), position_table, postlist_table, record_table, BrassDatabaseStats::set_oldest_changeset(), spelling_table, stats, Xapian::Internal::str(), synonym_table, termlist_table, value_manager, and BrassTable::write_changed_blocks().
Referenced by apply(), BrassDatabase(), and modifications_failed().
| bool BrassDatabase::term_exists | ( | const string & | tname | ) | const [virtual] |
Virtual methods of Database::Internal.
Implements Xapian::Database::Internal.
Reimplemented in BrassWritableDatabase.
Definition at line 873 of file brass_database.cc.
References Assert, LOGCALL, postlist_table, and BrassPostListTable::term_exists().
| void BrassDatabase::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 576 of file brass_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().
| BrassDatabase::XAPIAN_NORETURN | ( | void throw_termlist_table_close_exception() | const | ) |
friend class BrassAllDocsPostList [friend] |
Definition at line 58 of file brass_database.h.
Referenced by BrassWritableDatabase::open_post_list(), and open_post_list().
friend class BrassAllTermsList [friend] |
friend class BrassPostList [friend] |
Definition at line 56 of file brass_database.h.
Referenced by BrassWritableDatabase::open_post_list(), and open_post_list().
friend class BrassTermList [friend] |
friend class BrassWritableDatabase [friend] |
Definition at line 54 of file brass_database.h.
std::string BrassDatabase::db_dir [private] |
Directory to store databases in.
Definition at line 62 of file brass_database.h.
Referenced by BrassDatabase(), get_database_write_lock(), send_whole_database(), set_revision_number(), and write_changesets_to_fd().
FlintLock BrassDatabase::lock [private] |
Lock object.
Definition at line 112 of file brass_database.h.
Referenced by close(), and get_database_write_lock().
unsigned int BrassDatabase::max_changesets [private] |
The maximum number of changesets which should be kept in the database.
Definition at line 116 of file brass_database.h.
Referenced by set_revision_number().
Table storing position lists.
Definition at line 84 of file brass_database.h.
Referenced by BrassWritableDatabase::add_document_(), apply(), cancel(), close(), create_and_open_tables(), BrassWritableDatabase::delete_document(), has_positions(), open_position_list(), open_tables(), open_tables_consistent(), BrassWritableDatabase::replace_document(), and set_revision_number().
BrassPostListTable BrassDatabase::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 80 of file brass_database.h.
Referenced by apply(), BrassDatabase(), BrassWritableDatabase::cancel(), cancel(), close(), create_and_open_tables(), database_exists(), BrassWritableDatabase::flush_postlist_changes(), get_collection_freq(), get_doclength(), get_metadata(), get_next_revision_number(), get_postlist_cursor(), get_revision_number(), get_termfreq(), BrassWritableDatabase::open_allterms(), open_metadata_keylist(), BrassWritableDatabase::open_post_list(), open_tables(), open_tables_consistent(), BrassWritableDatabase::replace_document(), BrassWritableDatabase::set_metadata(), set_revision_number(), and term_exists().
bool BrassDatabase::readonly [private] |
Whether the database is readonly.
Definition at line 66 of file brass_database.h.
Referenced by reopen().
BrassRecordTable BrassDatabase::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 109 of file brass_database.h.
Referenced by BrassWritableDatabase::add_document_(), apply(), BrassDatabase(), cancel(), close(), create_and_open_tables(), database_exists(), BrassWritableDatabase::delete_document(), get_avlength(), get_doccount(), open_document(), open_tables(), open_tables_consistent(), BrassWritableDatabase::replace_document(), and set_revision_number().
BrassSpellingTable BrassDatabase::spelling_table [mutable, private] |
Table storing spelling correction data.
Definition at line 99 of file brass_database.h.
Referenced by BrassWritableDatabase::add_spelling(), apply(), cancel(), close(), create_and_open_tables(), get_spelling_frequency(), open_spelling_termlist(), BrassWritableDatabase::open_spelling_wordlist(), open_spelling_wordlist(), open_tables(), open_tables_consistent(), BrassWritableDatabase::remove_spelling(), and set_revision_number().
BrassDatabaseStats BrassDatabase::stats [private] |
Database statistics.
Definition at line 119 of file brass_database.h.
Referenced by BrassWritableDatabase::add_document(), BrassWritableDatabase::add_document_(), BrassWritableDatabase::cancel(), create_and_open_tables(), BrassWritableDatabase::delete_document(), BrassWritableDatabase::flush_postlist_changes(), get_avlength(), get_doclength_lower_bound(), get_doclength_upper_bound(), get_lastdocid(), get_total_length(), get_wdf_upper_bound(), BrassWritableDatabase::open_post_list(), open_post_list(), open_tables_consistent(), BrassWritableDatabase::replace_document(), and set_revision_number().
BrassSynonymTable BrassDatabase::synonym_table [mutable, private] |
Table storing synonym data.
Definition at line 95 of file brass_database.h.
Referenced by BrassWritableDatabase::add_synonym(), apply(), cancel(), BrassWritableDatabase::clear_synonyms(), close(), create_and_open_tables(), BrassWritableDatabase::open_synonym_keylist(), open_synonym_keylist(), open_synonym_termlist(), open_tables(), open_tables_consistent(), BrassWritableDatabase::remove_synonym(), and set_revision_number().
Table storing term lists.
Definition at line 88 of file brass_database.h.
Referenced by BrassWritableDatabase::add_document_(), apply(), cancel(), close(), create_and_open_tables(), BrassWritableDatabase::delete_document(), open_tables(), open_tables_consistent(), open_term_list(), BrassWritableDatabase::replace_document(), and set_revision_number().
BrassValueManager BrassDatabase::value_manager [mutable, private] |
Value manager.
Definition at line 91 of file brass_database.h.
Referenced by BrassWritableDatabase::add_document_(), BrassWritableDatabase::apply(), apply(), cancel(), BrassWritableDatabase::delete_document(), get_value_freq(), get_value_lower_bound(), get_value_upper_bound(), open_document(), open_tables(), open_tables_consistent(), BrassWritableDatabase::open_value_list(), BrassWritableDatabase::replace_document(), and set_revision_number().
BrassVersion BrassDatabase::version_file [private] |
The file describing the Brass 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 72 of file brass_database.h.
Referenced by create_and_open_tables(), get_uuid(), open_tables(), and open_tables_consistent().