include/xapian/replication.h

Go to the documentation of this file.
00001 
00004 /* Copyright 2008 Lemur Consulting Ltd
00005  * Copyright 2008 Olly Betts
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as
00009  * published by the Free Software Foundation; either version 2 of the
00010  * License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00020  * USA
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 /* XAPIAN_INCLUDED_REPLICATION_H */

Documentation for Xapian (version 1.1.2).
Generated on 23 Jul 2009 by Doxygen 1.5.2.