|
xapian-core
1.4.30
|
#include <glass_databasereplicator.h>
Inheritance diagram for GlassDatabaseReplicator:
Collaboration diagram for GlassDatabaseReplicator:Public Member Functions | |
| GlassDatabaseReplicator (const std::string &db_dir_) | |
| ~GlassDatabaseReplicator () | |
| bool | check_revision_at_least (const std::string &rev, const std::string &target) const |
| Virtual methods of DatabaseReplicator. More... | |
| std::string | apply_changeset_from_conn (RemoteConnection &conn, double end_time, bool valid) const |
| Read and apply the next changeset. More... | |
| std::string | get_uuid () const |
| Get a UUID for the replica. More... | |
Public Member Functions inherited from Xapian::DatabaseReplicator | |
| virtual | ~DatabaseReplicator () |
| Destroy the replicator. More... | |
Private Member Functions | |
| void | process_changeset_chunk_version (std::string &buf, RemoteConnection &conn, double end_time) const |
| Process a chunk which holds a version file. More... | |
| void | process_changeset_chunk_blocks (Glass::table_type table, unsigned v, std::string &buf, RemoteConnection &conn, double end_time) const |
| Process a chunk which holds a list of changed blocks in the database. More... | |
| void | commit () const |
Private Attributes | |
| std::string | db_dir |
| Path of database. More... | |
| int | fds [Glass::MAX_] |
| File descriptors for writing to each table. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Xapian::DatabaseReplicator | |
| static DatabaseReplicator * | open (const std::string &path) |
| Open a DatabaseReplicator for the given path. More... | |
Protected Member Functions inherited from Xapian::DatabaseReplicator | |
| DatabaseReplicator () | |
| Constructor to allow construction of subclasses from the open() method. More... | |
Definition at line 29 of file glass_databasereplicator.h.
|
explicit |
Definition at line 67 of file glass_databasereplicator.cc.
References fds.
| GlassDatabaseReplicator::~GlassDatabaseReplicator | ( | ) |
Definition at line 88 of file glass_databasereplicator.cc.
References close(), fds, and Glass::MAX_.
|
virtual |
Read and apply the next changeset.
| conn | The remote connection manager. |
| end_time | The time to timeout at. |
| db_valid | Whether the database is known to be valid at the start of the changeset. If this is true, some additional checks are performed. |
Implements Xapian::DatabaseReplicator.
Definition at line 218 of file glass_databasereplicator.cc.
References AssertEq, CHANGES_MAGIC_STRING, CHANGES_VERSION, commit(), CONST_STRLEN, db_dir, RealTime::end_time(), RemoteConnection::get_message_chunk(), RemoteConnection::get_message_chunked(), GlassVersion::get_revision(), FlintLock::lock(), LOGCALL, Glass::MAX_, pack_uint(), process_changeset_chunk_blocks(), process_changeset_chunk_version(), GlassVersion::read(), REASONABLE_CHANGESET_SIZE, REPL_REPLY_CHANGESET, RETURN, startswith(), Xapian::Internal::str(), FlintLock::SUCCESS, throw_connection_closed_unexpectedly(), FlintLock::throw_databaselockerror(), and unpack_uint().
|
virtual |
Virtual methods of DatabaseReplicator.
Implements Xapian::DatabaseReplicator.
Definition at line 99 of file glass_databasereplicator.cc.
References LOGCALL, RETURN, and unpack_uint().
|
private |
Definition at line 74 of file glass_databasereplicator.cc.
References close(), fds, io_sync(), and Glass::MAX_.
Referenced by apply_changeset_from_conn().
|
virtual |
Get a UUID for the replica.
If the UUID cannot be read (for example, because the database is not valid), this should return the empty string, rather than raising an exception.
Implements Xapian::DatabaseReplicator.
Definition at line 339 of file glass_databasereplicator.cc.
References db_dir, GlassVersion::get_uuid_string(), LOGCALL, GlassVersion::read(), and RETURN.
|
private |
Process a chunk which holds a list of changed blocks in the database.
Definition at line 173 of file glass_databasereplicator.cc.
References CONST_STRLEN, db_dir, dbnames, RealTime::end_time(), fds, RemoteConnection::get_message_chunk(), GLASS_TABLE_EXTENSION, io_write_block(), O_CLOEXEC, posixy_open, throw_connection_closed_unexpectedly(), and unpack_uint().
Referenced by apply_changeset_from_conn().
|
private |
Process a chunk which holds a version file.
Definition at line 123 of file glass_databasereplicator.cc.
References db_dir, RealTime::end_time(), RemoteConnection::get_message_chunk(), io_sync(), io_tmp_rename(), io_write(), O_CLOEXEC, posixy_open, throw_connection_closed_unexpectedly(), and unpack_uint().
Referenced by apply_changeset_from_conn().
|
private |
Path of database.
Definition at line 32 of file glass_databasereplicator.h.
Referenced by apply_changeset_from_conn(), get_uuid(), process_changeset_chunk_blocks(), and process_changeset_chunk_version().
|
mutableprivate |
File descriptors for writing to each table.
The corresponding entry is -1 if that table is not yet opened.
Definition at line 38 of file glass_databasereplicator.h.
Referenced by commit(), GlassDatabaseReplicator(), process_changeset_chunk_blocks(), and ~GlassDatabaseReplicator().