xapian-core  1.4.20
replication.h
Go to the documentation of this file.
1 
4 /* Copyright 2008 Lemur Consulting Ltd
5  * Copyright 2008,2011,2015,2016 Olly Betts
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22 
23 #ifndef XAPIAN_INCLUDED_REPLICATION_H
24 #define XAPIAN_INCLUDED_REPLICATION_H
25 
26 #include "xapian/visibility.h"
27 
28 #include <string>
29 
30 namespace Xapian {
31 
36 
39 
45  bool changed;
46 
48  : changeset_count(0),
49  fullcopy_count(0),
50  changed(false)
51  {}
52 
53  void clear() {
54  changeset_count = 0;
55  fullcopy_count = 0;
56  changed = false;
57  }
58 };
59 
63  std::string path;
64 
65  public:
71  explicit DatabaseMaster(const std::string & path_) : path(path_) {}
72 
101  void write_changesets_to_fd(int fd,
102  const std::string & start_revision,
103  ReplicationInfo * info) const;
104 
106  std::string get_description() const;
107 };
108 
116  class Internal;
118  Internal * internal;
119 
121  DatabaseReplica(const DatabaseReplica & other);
122 
124  void operator=(const DatabaseReplica & other);
125 
126  public:
128  ~DatabaseReplica();
129 
142  explicit DatabaseReplica(const std::string & path);
143 
152  std::string get_revision_info() const;
153 
161  void set_read_fd(int fd);
162 
193  bool apply_next_changeset(ReplicationInfo * info,
194  double reader_close_time);
195 
197  std::string get_description() const;
198 };
199 
200 }
201 
202 #endif /* XAPIAN_INCLUDED_REPLICATION_H */
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:80
int fullcopy_count
Number of times a full database copy was performed.
Definition: replication.h:38
Access to a master database for replication.
Definition: replication.h:61
Access to a database replica, for applying replication to it.
Definition: replication.h:114
#define false
Definition: header.h:9
#define XAPIAN_VISIBILITY_DEFAULT
Definition: visibility.h:28
DatabaseMaster(const std::string &path_)
Create a new DatabaseMaster for the database at the specified path.
Definition: replication.h:71
Define XAPIAN_VISIBILITY_* macros.
Information about the steps involved in performing a replication.
Definition: replication.h:33
int changeset_count
Number of changesets applied.
Definition: replication.h:35
bool changed
True if and only if the replication corresponds to a change in the live version of the database...
Definition: replication.h:45
Internal implementation of DatabaseReplica.
Definition: replication.cc:123
std::string path
The path to the master database.
Definition: replication.h:63