xapian-core  2.0.0
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, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef XAPIAN_INCLUDED_REPLICATION_H
23 #define XAPIAN_INCLUDED_REPLICATION_H
24 
25 #include "xapian/visibility.h"
26 
27 #include <string>
28 
29 namespace Xapian {
30 
34  int changeset_count = 0;
35 
37  int fullcopy_count = 0;
38 
44  bool changed = false;
45 
47 
48  void clear() {
49  changeset_count = 0;
50  fullcopy_count = 0;
51  changed = false;
52  }
53 };
54 
58  std::string path;
59 
60  public:
66  explicit DatabaseMaster(const std::string & path_) : path(path_) {}
67 
96  void write_changesets_to_fd(int fd,
97  const std::string & start_revision,
98  ReplicationInfo * info) const;
99 
101  std::string get_description() const;
102 };
103 
111  class Internal;
113  Internal * internal;
114 
117 
119  void operator=(const DatabaseReplica & other);
120 
121  public:
123  ~DatabaseReplica();
124 
137  explicit DatabaseReplica(const std::string & path);
138 
147  std::string get_revision_info() const;
148 
156  void set_read_fd(int fd);
157 
188  bool apply_next_changeset(ReplicationInfo * info,
189  double reader_close_time);
190 
192  std::string get_description() const;
193 };
194 
195 }
196 
197 #endif /* XAPIAN_INCLUDED_REPLICATION_H */
Internal implementation of DatabaseReplica.
Definition: replication.cc:122
Access to a master database for replication.
Definition: replication.h:56
DatabaseMaster(const std::string &path_)
Create a new DatabaseMaster for the database at the specified path.
Definition: replication.h:66
std::string path
The path to the master database.
Definition: replication.h:58
Access to a database replica, for applying replication to it.
Definition: replication.h:109
void operator=(const DatabaseReplica &other)
No assignment.
DatabaseReplica(const DatabaseReplica &other)
No copying.
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:82
Information about the steps involved in performing a replication.
Definition: replication.h:32
bool changed
True if and only if the replication corresponds to a change in the live version of the database.
Definition: replication.h:44
int fullcopy_count
Number of times a full database copy was performed.
Definition: replication.h:37
int changeset_count
Number of changesets applied.
Definition: replication.h:34
Define XAPIAN_VISIBILITY_* macros.
#define XAPIAN_VISIBILITY_DEFAULT
Definition: visibility.h:28