xapian-core  1.4.26
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Xapian::DatabaseReplica::Internal Class Reference

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...
 
RemoteConnectionconn
 The remote connection we're using. More...
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::intrusive_base
unsigned _refs
 Reference count. More...
 

Detailed Description

Internal implementation of DatabaseReplica.

Definition at line 123 of file replication.cc.

Constructor & Destructor Documentation

◆ Internal() [1/2]

Xapian::DatabaseReplica::Internal::Internal ( const Internal )
private

Don't allow copying.

◆ Internal() [2/2]

Xapian::DatabaseReplica::Internal::Internal ( const string &  path_)
explicit

◆ ~Internal()

Xapian::DatabaseReplica::Internal::~Internal ( )
inline

Destructor.

Definition at line 216 of file replication.cc.

Member Function Documentation

◆ apply_db_copy()

void Xapian::DatabaseReplica::Internal::apply_db_copy ( double  end_time)
private

◆ apply_next_changeset()

bool Xapian::DatabaseReplica::Internal::apply_next_changeset ( ReplicationInfo info,
double  reader_close_time 
)

◆ check_message_type()

void Xapian::DatabaseReplica::Internal::check_message_type ( int  type,
int  expected 
) const
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().

Referenced by Xapian::DatabaseReplica::Internal::apply_db_copy(), and Xapian::DatabaseReplica::Internal::apply_next_changeset().

◆ get_description()

string Xapian::DatabaseReplica::Internal::get_description ( ) const
inline

Return a string describing this object.

Definition at line 229 of file replication.cc.

◆ get_replica_path()

string Xapian::DatabaseReplica::Internal::get_replica_path ( int  id) const
inlineprivate

◆ get_revision_info()

string Xapian::DatabaseReplica::Internal::get_revision_info ( ) const

◆ operator=()

void Xapian::DatabaseReplica::Internal::operator= ( const Internal )
private

Don't allow assignment.

◆ possibly_make_offline_live()

bool Xapian::DatabaseReplica::Internal::possibly_make_offline_live ( )
private

◆ remove_offline_db()

void Xapian::DatabaseReplica::Internal::remove_offline_db ( )
private

◆ set_read_fd()

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.

References Xapian::DatabaseReplica::Internal::conn.

◆ update_stub_database()

void Xapian::DatabaseReplica::Internal::update_stub_database ( ) const
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(), and REPLICA_STUB_BANNER.

Referenced by Xapian::DatabaseReplica::Internal::Internal(), and Xapian::DatabaseReplica::Internal::possibly_make_offline_live().

Member Data Documentation

◆ conn

RemoteConnection* Xapian::DatabaseReplica::Internal::conn
private

◆ have_offline_db

bool Xapian::DatabaseReplica::Internal::have_offline_db
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.

Referenced by Xapian::DatabaseReplica::Internal::apply_db_copy(), Xapian::DatabaseReplica::Internal::apply_next_changeset(), and Xapian::DatabaseReplica::Internal::remove_offline_db().

◆ last_live_changeset_time

double Xapian::DatabaseReplica::Internal::last_live_changeset_time
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.

Referenced by Xapian::DatabaseReplica::Internal::apply_db_copy(), and Xapian::DatabaseReplica::Internal::apply_next_changeset().

◆ live_db

WritableDatabase Xapian::DatabaseReplica::Internal::live_db
mutableprivate

◆ live_id

int Xapian::DatabaseReplica::Internal::live_id
private

◆ need_copy_next

bool Xapian::DatabaseReplica::Internal::need_copy_next
private

Flag to indicate that the only valid operation next is a full copy.

Definition at line 151 of file replication.cc.

Referenced by Xapian::DatabaseReplica::Internal::apply_db_copy(), and Xapian::DatabaseReplica::Internal::apply_next_changeset().

◆ offline_needed_revision

string Xapian::DatabaseReplica::Internal::offline_needed_revision
private

The revision that the secondary database must reach before it can be made live.

Definition at line 164 of file replication.cc.

Referenced by Xapian::DatabaseReplica::Internal::apply_db_copy(), and Xapian::DatabaseReplica::Internal::possibly_make_offline_live().

◆ offline_revision

string Xapian::DatabaseReplica::Internal::offline_revision
private

◆ offline_uuid

string Xapian::DatabaseReplica::Internal::offline_uuid
private

◆ path

string Xapian::DatabaseReplica::Internal::path
private

The path to the replica directory.

Definition at line 131 of file replication.cc.

Referenced by Xapian::DatabaseReplica::Internal::Internal().


The documentation for this class was generated from the following file: