Branch data Line data Source code
1 : : /** @file chert_databasereplicator.h
2 : : * @brief Support for chert database replication
3 : : */
4 : : /* Copyright 2008 Lemur Consulting Ltd
5 : : * Copyright 2010 Richard Boulton
6 : : * Copyright 2010 Olly Betts
7 : : *
8 : : * This program is free software; you can redistribute it and/or
9 : : * modify it under the terms of the GNU General Public License as
10 : : * published by the Free Software Foundation; either version 2 of the
11 : : * License, or (at your option) any later version.
12 : : *
13 : : * This program is distributed in the hope that it will be useful,
14 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 : : * GNU General Public License for more details.
17 : : *
18 : : * You should have received a copy of the GNU General Public License
19 : : * along with this program; if not, write to the Free Software
20 : : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 : : * USA
22 : : */
23 : :
24 : : #ifndef XAPIAN_INCLUDED_CHERT_DATABASEREPLICATOR_H
25 : : #define XAPIAN_INCLUDED_CHERT_DATABASEREPLICATOR_H
26 : :
27 : : #include "databasereplicator.h"
28 : :
29 [ + - ][ # # ]: 66 : class ChertDatabaseReplicator : public Xapian::DatabaseReplicator {
30 : : private:
31 : : /** Path of database.
32 : : */
33 : : std::string db_dir;
34 : :
35 : : /** The maximum number of changesets which should be kept in the
36 : : * database. */
37 : : unsigned int max_changesets;
38 : :
39 : : /** Process a chunk which holds a base block.
40 : : */
41 : : void process_changeset_chunk_base(const std::string & tablename,
42 : : std::string & buf,
43 : : RemoteConnection & conn,
44 : : double end_time,
45 : : int changes_fd) const;
46 : :
47 : : /** Process a chunk which holds a list of changed blocks in the
48 : : * database.
49 : : */
50 : : void process_changeset_chunk_blocks(const std::string & tablename,
51 : : std::string & buf,
52 : : RemoteConnection & conn,
53 : : double end_time,
54 : : int changes_fd) const;
55 : :
56 : : public:
57 : : ChertDatabaseReplicator(const std::string & db_dir_);
58 : :
59 : : /** Virtual methods of DatabaseReplicator. */
60 : : //@{
61 : : bool check_revision_at_least(const std::string & rev,
62 : : const std::string & target) const;
63 : : std::string apply_changeset_from_conn(RemoteConnection & conn,
64 : : double end_time,
65 : : bool valid) const;
66 : : std::string get_uuid() const;
67 : : //@}
68 : : };
69 : :
70 : : #endif /* XAPIAN_INCLUDED_CHERT_DATABASEREPLICATOR_H */
|