#include <backendmanager.h>


Public Member Functions | |
| Xapian::WritableDatabase | getwritedb_brass (const std::string &name, const std::vector< std::string > &files) |
| Get a writable brass database instance. | |
| std::string | getwritedb_brass_path (const std::string &name) |
| Get the path of a writable brass database instance. | |
| Xapian::WritableDatabase | getwritedb_chert (const std::string &name, const std::vector< std::string > &files) |
| Get a writable chert database instance. | |
| std::string | getwritedb_chert_path (const std::string &name) |
| Get the path of a writable chert database instance. | |
| Xapian::WritableDatabase | getwritedb_flint (const std::string &name, const std::vector< std::string > &files) |
| Get a writable flint database instance. | |
| std::string | getwritedb_flint_path (const std::string &name) |
| Get the path of a writable flint database instance. | |
| BackendManager () | |
| Constructor - set up default state. | |
| virtual | ~BackendManager () |
| We have virtual methods and want to be able to delete derived classes using a pointer to the base class, so we need a virtual destructor. | |
| virtual std::string | get_dbtype () const |
| Get the database type currently in use. | |
| void | set_datadir (const std::string &datadir_) |
| Set the directory to store data in. | |
| const std::string & | get_datadir () const |
| Get the directory to store data in. | |
| Xapian::Database | get_database (const std::vector< std::string > &files) |
| Get a database instance of the current type. | |
| Xapian::Database | get_database (const std::string &file) |
| Get a database instance of the current type, single file case. | |
| Xapian::Database | get_database (const std::string &dbname, void(*gen)(Xapian::WritableDatabase &, const std::string &), const std::string &arg) |
| Get a database instance of the current type, generated case. | |
| std::string | get_database_path (const std::vector< std::string > &files) |
| Get the path of a database instance, if such a thing exists. | |
| std::string | get_database_path (const std::string &file) |
| Get the path of a database instance, if such a thing exists (single file case). | |
| std::string | get_database_path (const std::string &dbname, void(*gen)(Xapian::WritableDatabase &, const std::string &), const std::string &arg) |
| Get the path of a generated database instance. | |
| virtual Xapian::WritableDatabase | get_writable_database (const std::string &name, const std::string &file) |
| Get a writable database instance. | |
| virtual std::string | get_writable_database_path (const std::string &name) |
| Get the path of a writable database instance, if such a thing exists. | |
| virtual Xapian::Database | get_remote_database (const std::vector< std::string > &files, unsigned int timeout) |
| Get a remote database instance with the specified timeout. | |
| virtual Xapian::Database | get_writable_database_as_database () |
| Create a Database object for the last opened WritableDatabase. | |
| virtual Xapian::WritableDatabase | get_writable_database_again () |
| Create a WritableDatabase object for the last opened WritableDatabase. | |
| virtual void | clean_up () |
| Called after each test, to perform any necessary cleanup. | |
Static Public Member Functions | |
| static const char * | get_xapian_progsrv_command () |
| Get the command line required to run xapian-progsrv. | |
Protected Member Functions | |
| bool | create_dir_if_needed (const std::string &dirname) |
| Create the directory dirname if needed. | |
| virtual Xapian::Database | do_get_database (const std::vector< std::string > &files) |
| Virtual method implementing get_database(). | |
| virtual std::string | do_get_database_path (const std::vector< std::string > &files) |
| Virtual method implementing get_database_path(). | |
| Xapian::WritableDatabase | getwritedb_inmemory (const std::vector< std::string > &files) |
| Get a writable inmemory database instance. | |
| Xapian::Database | getdb_remoteprog (const std::vector< std::string > &files) |
| Get a remote database instance using xapian-progsrv. | |
| Xapian::WritableDatabase | getwritedb_remoteprog (const std::vector< std::string > &files) |
| Get a writable remote database instance using xapian-progsrv. | |
| Xapian::Database | getdb_remotetcp (const std::vector< std::string > &files) |
| Get a remote database instance using xapian-tcpsrv. | |
| Xapian::WritableDatabase | getwritedb_remotetcp (const std::vector< std::string > &files) |
| Get a writable remote database instance using xapian-tcpsrv. | |
| std::string | createdb_brass (const std::vector< std::string > &files) |
| std::string | createdb_chert (const std::vector< std::string > &files) |
| std::string | createdb_flint (const std::vector< std::string > &files) |
Private Member Functions | |
| void | index_files_to_database (Xapian::WritableDatabase &database, const std::vector< std::string > &files) |
| Index data from zero or more text files into a database. | |
Private Attributes | |
| std::string | datadir |
| The current data directory. | |
Definition at line 52 of file backendmanager.h.
| BackendManager::BackendManager | ( | ) | [inline] |
| BackendManager::~BackendManager | ( | ) | [virtual] |
We have virtual methods and want to be able to delete derived classes using a pointer to the base class, so we need a virtual destructor.
Definition at line 245 of file backendmanager.cc.
| void BackendManager::clean_up | ( | ) | [virtual] |
Called after each test, to perform any necessary cleanup.
May be called more than once for a given test in some cases.
Reimplemented in BackendManagerRemoteTcp.
Definition at line 390 of file backendmanager.cc.
Referenced by test_driver::do_run_tests(), and test_driver::runtest().
| bool BackendManager::create_dir_if_needed | ( | const std::string & | dirname | ) | [protected] |
Create the directory dirname if needed.
Returns true if the directory was created and false if it was already there. Throws an exception if there was an error (eg not a directory).
Definition at line 60 of file backendmanager.cc.
References mkdir(), S_ISDIR, and stat().
Referenced by createdb_brass(), createdb_chert(), createdb_flint(), BackendManagerMulti::createdb_multi(), getwritedb_brass(), getwritedb_brass_path(), getwritedb_chert(), getwritedb_chert_path(), getwritedb_flint(), and getwritedb_flint_path().
| string BackendManager::createdb_brass | ( | const std::vector< std::string > & | files | ) | [protected] |
Definition at line 89 of file backendmanager.cc.
References Xapian::WritableDatabase::commit(), create_dir_if_needed(), Xapian::DB_CREATE, index_files_to_database(), and Xapian::Brass::open().
Referenced by BackendManagerBrass::do_get_database_path(), and BackendManagerRemote::get_remote_database_args().
| string BackendManager::createdb_chert | ( | const std::vector< std::string > & | files | ) | [protected] |
Definition at line 141 of file backendmanager.cc.
References Xapian::WritableDatabase::commit(), create_dir_if_needed(), Xapian::DB_CREATE, index_files_to_database(), and Xapian::Chert::open().
Referenced by BackendManagerChert::do_get_database_path(), and BackendManagerRemote::get_remote_database_args().
| string BackendManager::createdb_flint | ( | const std::vector< std::string > & | files | ) | [protected] |
Definition at line 194 of file backendmanager.cc.
References Xapian::WritableDatabase::commit(), create_dir_if_needed(), Xapian::DB_CREATE, index_files_to_database(), and Xapian::Flint::open().
Referenced by BackendManagerFlint::do_get_database_path(), and BackendManagerRemote::get_remote_database_args().
| Xapian::Database BackendManager::do_get_database | ( | const std::vector< std::string > & | files | ) | [protected, virtual] |
Virtual method implementing get_database().
If we just called this get_database() then each subclass which defined it would also need to un-hide the non-virtual overloaded method with "using get_database(const std::string&);" or similar.
Reimplemented in BackendManagerInMemory, BackendManagerRemoteProg, and BackendManagerRemoteTcp.
Definition at line 260 of file backendmanager.cc.
References do_get_database_path().
Referenced by get_database().
| string BackendManager::do_get_database_path | ( | const std::vector< std::string > & | files | ) | [protected, virtual] |
Virtual method implementing get_database_path().
If we just called this get_database_path() then each subclass which defined it would also need to un-hide the non-virtual overloaded method with "using get_database_path(const std::string&);" or similar.
Reimplemented in BackendManagerBrass, BackendManagerChert, BackendManagerFlint, and BackendManagerMulti.
Definition at line 254 of file backendmanager.cc.
Referenced by do_get_database(), and get_database_path().
| Xapian::Database BackendManager::get_database | ( | const std::string & | dbname, | |
| void(*)(Xapian::WritableDatabase &, const std::string &) | gen, | |||
| const std::string & | arg | |||
| ) |
Get a database instance of the current type, generated case.
| dbname | The name of the database (base on your testcase name). | |
| gen | Generator function - should index data to the empty WritableDatabase provided. | |
| arg | String argument to pass to gen - it's up to you how to make use of this (or just ignore it if you don't need it). |
Definition at line 278 of file backendmanager.cc.
References get_writable_database(), get_writable_database_path(), and rm_rf().
| Xapian::Database BackendManager::get_database | ( | const std::string & | file | ) |
Get a database instance of the current type, single file case.
Definition at line 272 of file backendmanager.cc.
References do_get_database().
| Xapian::Database BackendManager::get_database | ( | const std::vector< std::string > & | files | ) |
Get a database instance of the current type.
Definition at line 266 of file backendmanager.cc.
References do_get_database().
Referenced by DEFINE_TESTCASE(), and get_database().
| std::string BackendManager::get_database_path | ( | const std::string & | dbname, | |
| void(*)(Xapian::WritableDatabase &, const std::string &) | gen, | |||
| const std::string & | arg | |||
| ) |
Get the path of a generated database instance.
Definition at line 308 of file backendmanager.cc.
References get_writable_database(), get_writable_database_path(), and rm_rf().
| string BackendManager::get_database_path | ( | const std::string & | file | ) |
Get the path of a database instance, if such a thing exists (single file case).
Definition at line 345 of file backendmanager.cc.
References do_get_database_path().
| string BackendManager::get_database_path | ( | const std::vector< std::string > & | files | ) |
Get the path of a database instance, if such a thing exists.
Definition at line 339 of file backendmanager.cc.
References do_get_database_path().
Referenced by get_database_path().
| const std::string& BackendManager::get_datadir | ( | ) | const [inline] |
Get the directory to store data in.
Definition at line 156 of file backendmanager.h.
References datadir.
Referenced by BackendManagerMulti::createdb_multi().
| std::string BackendManager::get_dbtype | ( | ) | const [virtual] |
Get the database type currently in use.
Reimplemented in BackendManagerBrass, BackendManagerChert, BackendManagerFlint, BackendManagerInMemory, BackendManagerMulti, BackendManagerRemoteProg, and BackendManagerRemoteTcp.
Definition at line 248 of file backendmanager.cc.
Referenced by TestRunner::do_tests_for_backend(), get_dbtype(), get_remote_database(), get_writable_database_again(), get_writable_database_as_database(), ApiTestRunner::run(), and PerfTestLogger::testcase_begin().
| Xapian::Database BackendManager::get_remote_database | ( | const std::vector< std::string > & | files, | |
| unsigned int | timeout | |||
| ) | [virtual] |
Get a remote database instance with the specified timeout.
Reimplemented in BackendManagerRemoteProg, and BackendManagerRemoteTcp.
Definition at line 363 of file backendmanager.cc.
References get_dbtype().
Referenced by get_remote_database().
| Xapian::WritableDatabase BackendManager::get_writable_database | ( | const std::string & | name, | |
| const std::string & | file | |||
| ) | [virtual] |
Get a writable database instance.
Reimplemented in BackendManagerBrass, BackendManagerChert, BackendManagerFlint, BackendManagerInMemory, BackendManagerMulti, BackendManagerRemoteProg, and BackendManagerRemoteTcp.
Definition at line 351 of file backendmanager.cc.
Referenced by DEFINE_TESTCASE(), get_database(), get_database_path(), get_named_writable_database(), and get_writable_database().
| Xapian::WritableDatabase BackendManager::get_writable_database_again | ( | ) | [virtual] |
Create a WritableDatabase object for the last opened WritableDatabase.
Reimplemented in BackendManagerBrass, BackendManagerChert, BackendManagerFlint, BackendManagerRemoteProg, and BackendManagerRemoteTcp.
Definition at line 381 of file backendmanager.cc.
References get_dbtype().
Referenced by get_writable_database_again().
| Xapian::Database BackendManager::get_writable_database_as_database | ( | ) | [virtual] |
Create a Database object for the last opened WritableDatabase.
Reimplemented in BackendManagerBrass, BackendManagerChert, BackendManagerFlint, BackendManagerRemoteProg, and BackendManagerRemoteTcp.
Definition at line 372 of file backendmanager.cc.
References get_dbtype().
Referenced by get_writable_database_as_database().
| string BackendManager::get_writable_database_path | ( | const std::string & | name | ) | [virtual] |
Get the path of a writable database instance, if such a thing exists.
Reimplemented in BackendManagerBrass, BackendManagerChert, and BackendManagerFlint.
Definition at line 357 of file backendmanager.cc.
Referenced by get_database(), get_database_path(), and get_named_writable_database_path().
| const char * BackendManager::get_xapian_progsrv_command | ( | ) | [static] |
Get the command line required to run xapian-progsrv.
Definition at line 395 of file backendmanager.cc.
References XAPIAN_PROGSRV.
Referenced by DEFINE_TESTCASE().
| Xapian::Database BackendManager::getdb_remoteprog | ( | const std::vector< std::string > & | files | ) | [protected] |
Get a remote database instance using xapian-progsrv.
| Xapian::Database BackendManager::getdb_remotetcp | ( | const std::vector< std::string > & | files | ) | [protected] |
Get a remote database instance using xapian-tcpsrv.
| Xapian::WritableDatabase BackendManager::getwritedb_brass | ( | const std::string & | name, | |
| const std::vector< std::string > & | files | |||
| ) |
Get a writable brass database instance.
Definition at line 111 of file backendmanager.cc.
References create_dir_if_needed(), Xapian::DB_CREATE, getwritedb_brass_path(), index_files_to_database(), Xapian::Brass::open(), and rm_rf().
Referenced by BackendManagerBrass::get_writable_database(), and BackendManagerRemote::get_writable_database_args().
| std::string BackendManager::getwritedb_brass_path | ( | const std::string & | name | ) |
Get the path of a writable brass database instance.
Definition at line 127 of file backendmanager.cc.
References create_dir_if_needed().
Referenced by BackendManagerBrass::get_writable_database_path(), and getwritedb_brass().
| Xapian::WritableDatabase BackendManager::getwritedb_chert | ( | const std::string & | name, | |
| const std::vector< std::string > & | files | |||
| ) |
Get a writable chert database instance.
Definition at line 163 of file backendmanager.cc.
References create_dir_if_needed(), Xapian::DB_CREATE, getwritedb_chert_path(), index_files_to_database(), Xapian::Chert::open(), and rm_rf().
Referenced by BackendManagerChert::get_writable_database(), and BackendManagerRemote::get_writable_database_args().
| std::string BackendManager::getwritedb_chert_path | ( | const std::string & | name | ) |
Get the path of a writable chert database instance.
Definition at line 179 of file backendmanager.cc.
References create_dir_if_needed().
Referenced by BackendManagerChert::get_writable_database_path(), and getwritedb_chert().
| Xapian::WritableDatabase BackendManager::getwritedb_flint | ( | const std::string & | name, | |
| const std::vector< std::string > & | files | |||
| ) |
Get a writable flint database instance.
Definition at line 216 of file backendmanager.cc.
References create_dir_if_needed(), Xapian::DB_CREATE, getwritedb_flint_path(), index_files_to_database(), Xapian::Flint::open(), and rm_rf().
Referenced by BackendManagerFlint::get_writable_database(), and BackendManagerRemote::get_writable_database_args().
| std::string BackendManager::getwritedb_flint_path | ( | const std::string & | name | ) |
Get the path of a writable flint database instance.
Definition at line 232 of file backendmanager.cc.
References create_dir_if_needed().
Referenced by BackendManagerFlint::get_writable_database_path(), and getwritedb_flint().
| Xapian::WritableDatabase BackendManager::getwritedb_inmemory | ( | const std::vector< std::string > & | files | ) | [protected] |
Get a writable inmemory database instance.
Definition at line 79 of file backendmanager.cc.
References index_files_to_database(), and Xapian::InMemory::open().
Referenced by BackendManagerInMemory::do_get_database(), and BackendManagerInMemory::get_writable_database().
| Xapian::WritableDatabase BackendManager::getwritedb_remoteprog | ( | const std::vector< std::string > & | files | ) | [protected] |
Get a writable remote database instance using xapian-progsrv.
| Xapian::WritableDatabase BackendManager::getwritedb_remotetcp | ( | const std::vector< std::string > & | files | ) | [protected] |
Get a writable remote database instance using xapian-tcpsrv.
| void BackendManager::index_files_to_database | ( | Xapian::WritableDatabase & | database, | |
| const std::vector< std::string > & | files | |||
| ) | [private] |
Index data from zero or more text files into a database.
Definition at line 48 of file backendmanager.cc.
References Xapian::WritableDatabase::add_document(), datadir, and FileIndexer::next().
Referenced by createdb_brass(), createdb_chert(), createdb_flint(), getwritedb_brass(), getwritedb_chert(), getwritedb_flint(), and getwritedb_inmemory().
| void BackendManager::set_datadir | ( | const std::string & | datadir_ | ) | [inline] |
Set the directory to store data in.
Definition at line 152 of file backendmanager.h.
References datadir.
Referenced by TestRunner::do_tests_for_backend().
std::string BackendManager::datadir [private] |
The current data directory.
Definition at line 54 of file backendmanager.h.
Referenced by get_datadir(), index_files_to_database(), and set_datadir().