33 #define CACHE_DIRECTORY ".honey"
39 create_dir_if_needed(dbdir);
42 vector<string>::const_iterator i;
43 for (i = files.begin(); i != files.end(); ++i) {
47 string dbpath = dbdir +
"/" + dbname;
51 string db_source = dbpath +
".src";
54 string tmp_path = dbpath;
66 if (rename(tmp_path.c_str(), dbpath.c_str()) < 0) {
79 return generated_sub_manager->get_generated_database(
name);
88 string generated_db_path =
89 generated_sub_manager->get_generated_database_path(
name);
95 string tmp_path = path +
".tmp";
104 if (rename(tmp_path.c_str(), path.c_str()) < 0) {
BackendManager subclass for honey databases.
Xapian::WritableDatabase get_generated_database(const std::string &name)
Get generated database for honey.
std::string get_compaction_output_path(const std::string &name)
Get a path to compact a database to.
std::string do_get_database_path(const std::vector< std::string > &files)
Get the path of Honey Xapian::Database instance.
Xapian::WritableDatabase get_writable_database(const std::string &name, const std::string &file)
Create a Xapian::WritableDatabase object.
std::string get_generated_database_path(const std::string &name)
Get the path to use for generating a database, if supported.
void finalise_generated_database(const std::string &name)
Finalise generated database.
void index_to(Xapian::WritableDatabase &db)
DatabaseError indicates some sort of database related error.
An indexed database of documents.
void close()
Close the database.
void compact(std::string_view output, unsigned flags=0, int block_size=0)
Produce a compact version of this database.
UnimplementedError indicates an attempt to use an unimplemented feature.
This class provides read/write access to a database.
void commit()
Commit pending modifications.
Utility functions for testing files.
bool dir_exists(const char *path)
Test if a directory exists.
utility functions for indexing testcase data
const int DB_BACKEND_HONEY
Use the honey backend.
const int DB_BACKEND_GLASS
Use the glass backend.
const int DBCOMPACT_NO_RENUMBER
Use the same document ids in the output as in the input(s).
const int DB_CREATE_OR_OVERWRITE
Create database if it doesn't already exist, or overwrite if it does.
void rm_rf(const string &filename)
Remove a directory and contents, just like the Unix "rm -rf" command.
C++ function versions of useful Unix commands.