Reduce overheads of PostList positional data support
[xapian.git] / xapian-core / backends / glass / glass_databasereplicator.h
blob34c7d62944dbbec33d4902b4a71d7ce8bc3cc218
1 /** @file glass_databasereplicator.h
2 * @brief Support for glass database replication
3 */
4 /* Copyright 2008 Lemur Consulting Ltd
5 * Copyright 2009,2010,2011,2014 Olly Betts
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.
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.
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
23 #ifndef XAPIAN_INCLUDED_GLASS_DATABASEREPLICATOR_H
24 #define XAPIAN_INCLUDED_GLASS_DATABASEREPLICATOR_H
26 #include "backends/databasereplicator.h"
27 #include "glass_defs.h"
29 class GlassDatabaseReplicator : public Xapian::DatabaseReplicator {
30 private:
31 /** Path of database.
33 std::string db_dir;
35 /** File descriptors for writing to each table.
37 * The corresponding entry is -1 if that table is not yet opened.
39 mutable int fds[Glass::MAX_];
41 /** Process a chunk which holds a version file.
43 void process_changeset_chunk_version(std::string & buf,
44 RemoteConnection & conn,
45 double end_time) const;
47 /** Process a chunk which holds a list of changed blocks in the
48 * database.
50 void process_changeset_chunk_blocks(Glass::table_type table,
51 unsigned v,
52 std::string & buf,
53 RemoteConnection & conn,
54 double end_time) const;
56 void commit() const;
58 public:
59 explicit GlassDatabaseReplicator(const std::string & db_dir_);
61 ~GlassDatabaseReplicator();
63 /** Virtual methods of DatabaseReplicator. */
64 //@{
65 bool check_revision_at_least(const std::string & rev,
66 const std::string & target) const;
67 std::string apply_changeset_from_conn(RemoteConnection & conn,
68 double end_time,
69 bool valid) const;
70 std::string get_uuid() const;
71 //@}
74 #endif /* XAPIAN_INCLUDED_GLASS_DATABASEREPLICATOR_H */