2 * @brief BackendManager subclass for multi databases.
4 /* Copyright (C) 2007,2009,2017,2018,2019,2020 Olly Betts
5 * Copyright (C) 2008 Lemur Consulting Ltd
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 USA
22 #ifndef XAPIAN_INCLUDED_BACKENDMANAGER_MULTI_H
23 #define XAPIAN_INCLUDED_BACKENDMANAGER_MULTI_H
25 #include "backendmanager.h"
30 #include <xapian/database.h>
32 /// BackendManager subclass for multi databases.
33 class BackendManagerMulti
: public BackendManager
{
34 /// Don't allow assignment.
35 void operator=(const BackendManagerMulti
&);
37 /// Don't allow copying.
38 BackendManagerMulti(const BackendManagerMulti
&);
40 /// The path of the last writable database used.
41 std::string last_wdb_path
;
43 // vector of sub_managers.
44 std::vector
<BackendManager
*> sub_managers
;
48 std::string
createdb_multi(const std::string
& name
,
49 const std::vector
<std::string
>& files
);
52 /// Get the path of the Xapian::Database instance.
53 std::string
do_get_database_path(const std::vector
<std::string
> & files
);
56 BackendManagerMulti(const std::string
& datadir_
,
57 const std::vector
<BackendManager
*>& sub_manager_
);
59 Xapian::Database
get_remote_database(const std::vector
<std::string
>& files
,
63 /// Create a Multi Xapian::WritableDatabase object indexing a single file.
64 Xapian::WritableDatabase
get_writable_database(const std::string
& name
, const std::string
& file
);
66 /// Get the path of Xapian::WritableDatabase instance.
67 std::string
get_writable_database_path(const std::string
& name
);
69 std::string
get_compaction_output_path(const std::string
& name
);
71 std::string
get_generated_database_path(const std::string
& name
);
73 /// Create a WritableDatabase object for the last opened WritableDatabase.
74 Xapian::WritableDatabase
get_writable_database_again();
76 /// Get the path of the last opened WritableDatabase.
77 std::string
get_writable_database_path_again();
80 #endif // XAPIAN_INCLUDED_BACKENDMANAGER_MULTI_H