|
xapian-core
1.4.30
|
Internal implementation of DatabaseReplica. More...
Inheritance diagram for Xapian::DatabaseReplica::Internal:
Collaboration diagram for Xapian::DatabaseReplica::Internal:Public Member Functions | |
| Internal (const string &path_) | |
| Open a new DatabaseReplica::Internal for the specified path. More... | |
| ~Internal () | |
| Destructor. More... | |
| string | get_revision_info () const |
| Get a string describing the current revision of the replica. More... | |
| void | set_read_fd (int fd) |
| Set the file descriptor to read changesets from. More... | |
| bool | apply_next_changeset (ReplicationInfo *info, double reader_close_time) |
| Read and apply the next changeset. More... | |
| string | get_description () const |
| Return a string describing this object. More... | |
Public Member Functions inherited from Xapian::Internal::intrusive_base | |
| intrusive_base () | |
| Construct with no references. More... | |
Private Member Functions | |
| void | operator= (const Internal &) |
| Don't allow assignment. More... | |
| Internal (const Internal &) | |
| Don't allow copying. More... | |
| void | update_stub_database () const |
| Update the stub database which points to a single database. More... | |
| void | remove_offline_db () |
| Delete the offline database. More... | |
| void | apply_db_copy (double end_time) |
| Apply a set of DB copy messages from the connection. More... | |
| void | check_message_type (int type, int expected) const |
| Check that a message type is as expected. More... | |
| bool | possibly_make_offline_live () |
| Check if the offline database has reached the required version. More... | |
| string | get_replica_path (int id) const |
Private Attributes | |
| string | path |
| The path to the replica directory. More... | |
| int | live_id |
| The id of the currently live database in the replica (0 or 1). More... | |
| WritableDatabase | live_db |
| The live database being replicated. More... | |
| bool | have_offline_db |
| Do we have an offline database currently? More... | |
| bool | need_copy_next |
| Flag to indicate that the only valid operation next is a full copy. More... | |
| string | offline_revision |
| The revision that the secondary database has been updated to. More... | |
| string | offline_uuid |
| The UUID of the secondary database. More... | |
| string | offline_needed_revision |
| The revision that the secondary database must reach before it can be made live. More... | |
| double | last_live_changeset_time |
| The time at which a changeset was last applied to the live database. More... | |
| RemoteConnection * | conn |
| The remote connection we're using. More... | |
Additional Inherited Members | |
Public Attributes inherited from Xapian::Internal::intrusive_base | |
| unsigned | _refs |
| Reference count. More... | |
Internal implementation of DatabaseReplica.
Definition at line 123 of file replication.cc.
|
private |
Don't allow copying.
|
explicit |
Open a new DatabaseReplica::Internal for the specified path.
Definition at line 300 of file replication.cc.
References Xapian::DB_BACKEND_STUB, Xapian::DB_CREATE, Xapian::DB_OPEN, dir_exists(), Xapian::DatabaseReplica::Internal::get_replica_path(), Xapian::Database::internal, Xapian::DatabaseReplica::Internal::live_db, Xapian::DatabaseReplica::Internal::live_id, LOGCALL_CTOR, Xapian::DatabaseReplica::Internal::path, and Xapian::DatabaseReplica::Internal::update_stub_database().
|
inline |
Destructor.
Definition at line 216 of file replication.cc.
|
private |
Apply a set of DB copy messages from the connection.
Definition at line 377 of file replication.cc.
References decode_length_and_check(), RealTime::end_time(), removedir(), REPL_REPLY_DB_FILEDATA, REPL_REPLY_DB_FILENAME, REPL_REPLY_DB_FOOTER, REPL_REPLY_DB_HEADER, REPL_REPLY_FAIL, and throw_connection_closed_unexpectedly().
| bool Xapian::DatabaseReplica::Internal::apply_next_changeset | ( | ReplicationInfo * | info, |
| double | reader_close_time | ||
| ) |
Read and apply the next changeset.
Definition at line 497 of file replication.cc.
References Xapian::ReplicationInfo::changed, Xapian::ReplicationInfo::changeset_count, Xapian::DB_OPEN, Xapian::ReplicationInfo::fullcopy_count, LOGCALL, RealTime::now(), Xapian::InMemory::open(), REPL_REPLY_CHANGESET, REPL_REPLY_DB_HEADER, REPL_REPLY_END_OF_CHANGES, REPL_REPLY_FAIL, RETURN, RealTime::sleep(), Xapian::Internal::str(), and throw_connection_closed_unexpectedly().
Referenced by Xapian::DatabaseReplica::apply_next_changeset().
|
private |
Check that a message type is as expected.
Throws a NetworkError if the type is not the expected one.
Definition at line 439 of file replication.cc.
References Xapian::Internal::str(), and throw_connection_closed_unexpectedly().
|
inline |
Return a string describing this object.
Definition at line 229 of file replication.cc.
|
inlineprivate |
Definition at line 204 of file replication.cc.
Referenced by Xapian::DatabaseReplica::Internal::Internal().
| string Xapian::DatabaseReplica::Internal::get_revision_info | ( | ) | const |
Get a string describing the current revision of the replica.
Definition at line 351 of file replication.cc.
References Xapian::DB_OPEN, encode_length(), LOGCALL, and RETURN.
Referenced by Xapian::DatabaseReplica::get_revision_info().
|
private |
Don't allow assignment.
|
private |
Check if the offline database has reached the required version.
If so, make it live, and remove the old live database.
Definition at line 453 of file replication.cc.
References Xapian::DB_OPEN, and Xapian::InMemory::open().
|
private |
| void Xapian::DatabaseReplica::Internal::set_read_fd | ( | int | fd | ) |
Set the file descriptor to read changesets from.
Definition at line 489 of file replication.cc.
|
private |
Update the stub database which points to a single database.
The stub database file is created at a separate path, and then atomically moved into place to replace the old stub database. This should allow searches to continue uninterrupted.
Definition at line 282 of file replication.cc.
References io_tmp_rename(), Xapian::DatabaseReplica::Internal::live_id, Xapian::DatabaseReplica::Internal::path, and REPLICA_STUB_BANNER.
Referenced by Xapian::DatabaseReplica::Internal::Internal().
|
private |
The remote connection we're using.
Definition at line 173 of file replication.cc.
|
private |
Do we have an offline database currently?
The offline database is a new copy of the database we're bringing up to the required revision, which can't yet be made live.
Definition at line 147 of file replication.cc.
|
private |
The time at which a changeset was last applied to the live database.
Set to 0 if no changeset applied to the live database so far.
Definition at line 170 of file replication.cc.
|
mutableprivate |
The live database being replicated.
This needs to be mutable because it is sometimes lazily opened.
Definition at line 140 of file replication.cc.
Referenced by Xapian::DatabaseReplica::Internal::Internal().
|
private |
The id of the currently live database in the replica (0 or 1).
Definition at line 134 of file replication.cc.
Referenced by Xapian::DatabaseReplica::Internal::Internal(), and Xapian::DatabaseReplica::Internal::update_stub_database().
|
private |
Flag to indicate that the only valid operation next is a full copy.
Definition at line 151 of file replication.cc.
|
private |
The revision that the secondary database must reach before it can be made live.
Definition at line 164 of file replication.cc.
|
private |
The revision that the secondary database has been updated to.
Definition at line 155 of file replication.cc.
|
private |
The UUID of the secondary database.
Definition at line 159 of file replication.cc.
|
private |
The path to the replica directory.
Definition at line 131 of file replication.cc.
Referenced by Xapian::DatabaseReplica::Internal::Internal(), and Xapian::DatabaseReplica::Internal::update_stub_database().