00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef XAPIAN_INCLUDED_REPLICATION_H
00024 #define XAPIAN_INCLUDED_REPLICATION_H
00025
00026 #include <xapian/base.h>
00027 #include <xapian/visibility.h>
00028
00029 #include <string>
00030
00031 namespace Xapian {
00032
00038 struct XAPIAN_VISIBILITY_DEFAULT ReplicationInfo {
00040 int changeset_count;
00041
00043 int fullcopy_count;
00044
00050 bool changed;
00051
00052 ReplicationInfo()
00053 : changeset_count(0),
00054 fullcopy_count(0),
00055 changed(false)
00056 {}
00057
00058 void clear() {
00059 changeset_count = 0;
00060 fullcopy_count = 0;
00061 changed = false;
00062 }
00063 };
00064
00070 class XAPIAN_VISIBILITY_DEFAULT DatabaseMaster {
00072 std::string path;
00073
00074 public:
00080 DatabaseMaster(const std::string & path_) : path(path_) {}
00081
00110 void write_changesets_to_fd(int fd,
00111 const std::string & start_revision,
00112 ReplicationInfo * info) const;
00113
00115 std::string get_description() const;
00116 };
00117
00123 class XAPIAN_VISIBILITY_DEFAULT DatabaseReplica {
00125 class Internal;
00127 Xapian::Internal::RefCntPtr<Internal> internal;
00128
00129 public:
00131 DatabaseReplica(const DatabaseReplica & other);
00132
00134 void operator=(const DatabaseReplica & other);
00135
00137 DatabaseReplica();
00138
00140 ~DatabaseReplica();
00141
00154 DatabaseReplica(const std::string & path);
00155
00164 std::string get_revision_info() const;
00165
00173 void set_read_fd(int fd);
00174
00202 bool apply_next_changeset(ReplicationInfo * info);
00203
00211 void close();
00212
00214 std::string get_description() const;
00215 };
00216
00217 }
00218
00219 #endif