41 #ifdef XAPIAN_HAS_GLASS_BACKEND
45 #ifdef XAPIAN_HAS_HONEY_BACKEND
49 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
66 [&db](string_view path) {
69 [&db](string_view path) {
70 #ifdef XAPIAN_HAS_GLASS_BACKEND
76 [&db](string_view path) {
77 #ifdef XAPIAN_HAS_HONEY_BACKEND
83 [&db](string_view prog, string_view args) {
84 #ifdef XAPIAN_HAS_REMOTE_BACKEND
91 [&db](string_view host,
unsigned port) {
92 #ifdef XAPIAN_HAS_REMOTE_BACKEND
100 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
118 [&db, flags](string_view path) {
121 [&db, &flags](string_view path) {
126 auto msg =
"Honey databases don't support writing";
129 [&db, flags](string_view prog, string_view args) {
130 #ifdef XAPIAN_HAS_REMOTE_BACKEND
138 [&db, flags](string_view host,
unsigned port) {
139 #ifdef XAPIAN_HAS_REMOTE_BACKEND
157 Database::Database(string_view path,
int flags)
162 int type = flags & DB_BACKEND_MASK_;
165 #ifdef XAPIAN_HAS_GLASS_BACKEND
172 #ifdef XAPIAN_HAS_HONEY_BACKEND
182 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
190 string filename{path};
192 if (stat(filename.c_str(), &statbuf) == -1) {
193 if (errno == ENOENT) {
202 if (
S_ISREG(statbuf.st_mode)) {
209 #ifdef XAPIAN_HAS_GLASS_BACKEND
217 #ifdef XAPIAN_HAS_HONEY_BACKEND
232 "'" + filename +
"'");
235 #ifdef XAPIAN_HAS_GLASS_BACKEND
236 filename +=
"/iamglass";
243 #ifdef XAPIAN_HAS_HONEY_BACKEND
244 filename.resize(path.size());
245 filename +=
"/iamhoney";
253 filename.resize(path.size());
254 filename +=
"/XAPIANDB";
260 #ifndef XAPIAN_HAS_GLASS_BACKEND
261 filename.resize(path.size());
262 filename +=
"/iamglass";
267 #ifndef XAPIAN_HAS_HONEY_BACKEND
268 filename.resize(path.size());
269 filename +=
"/iamhoney";
274 filename.resize(path.size());
275 filename +=
"/iamchert";
279 filename.resize(path.size());
280 filename +=
"/iamflint";
301 #if defined XAPIAN_HAS_GLASS_BACKEND || defined XAPIAN_HAS_HONEY_BACKEND
302 int type = flags & DB_BACKEND_MASK_;
314 #ifdef XAPIAN_HAS_GLASS_BACKEND
318 #ifdef XAPIAN_HAS_HONEY_BACKEND
335 #if defined XAPIAN_HAS_GLASS_BACKEND
336 #define HAVE_DISK_BACKEND
344 LOGCALL_CTOR(API,
"WritableDatabase", path|flags|block_size);
347 string filename{path};
348 int type = flags & DB_BACKEND_MASK_;
350 flags &= ~DB_BACKEND_MASK_;
353 if (stat(filename.c_str(), &statbuf) == -1) {
361 if (
S_ISREG(statbuf.st_mode)) {
369 "'" + filename +
"'");
372 filename +=
"/iamglass";
375 #ifdef XAPIAN_HAS_GLASS_BACKEND
382 filename.resize(path.size());
383 filename +=
"/iamhoney";
387 "updating existing databases");
390 filename.resize(path.size());
391 filename +=
"/iamchert";
397 filename.resize(path.size());
398 filename +=
"/iamflint";
405 filename.resize(path.size());
406 filename +=
"/XAPIANDB";
421 #ifdef XAPIAN_HAS_GLASS_BACKEND
428 "updating existing databases");
430 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
437 #ifndef HAVE_DISK_BACKEND
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
A writable glass database.
Database using honey backend.
A database held entirely in memory.
Indicates an attempt to access a database not present.
DatabaseOpeningError indicates failure to open a database.
Virtual base class for Database internals.
An indexed database of documents.
Database()
Construct a Database containing no shards.
void add_database(const Database &other)
Add shards from another Database.
Xapian::Internal::intrusive_ptr_nonnull< Internal > internal
Indicates an attempt to use a feature which is unavailable.
InvalidArgumentError indicates an invalid parameter value was passed to the API.
InvalidOperationError indicates the API was used in an invalid way.
This class provides read/write access to a database.
void add_database(const WritableDatabase &other)
Add shards from another WritableDatabase.
WritableDatabase()
Create a WritableDatabase with no subdatabases.
Constants in the Xapian namespace.
An indexed database of documents.
int test_if_single_file_db(int fd)
Probe if a file descriptor is a single-file database.
Helper functions for database handling.
void read_stub_file(std::string_view file, A1 action_auto, A2 action_glass, A3 action_honey, A4 action_remote_prog, A5 action_remote_tcp, A6 action_inmemory)
Open, read and process a stub database file.
Virtual base class for Database internals.
Factory functions for constructing Database and WritableDatabase objects.
#define LOGCALL_CTOR(CATEGORY, CLASS, PARAMS)
Hierarchy of classes which Xapian can throw as exceptions.
Utility functions for testing files.
bool file_exists(const char *path)
Test if a file exists.
File and path manipulation routines.
C++ class definition for glass database.
Definitions, types, etc for use inside glass.
Database using honey backend.
Definitions, types, etc for use inside honey.
C++ class definition for inmemory database access.
WritableDatabase open_writable(std::string_view host, unsigned int port, unsigned timeout=0, unsigned connect_timeout=10000, int flags=0)
Construct a WritableDatabase object for update access to a remote database accessed via a TCP connect...
Database open(std::string_view host, unsigned int port, unsigned timeout=10000, unsigned connect_timeout=10000)
Construct a Database object for read-only access to a remote database accessed via a TCP connection.
The Xapian namespace contains public interfaces for the Xapian library.
const int DB_BACKEND_INMEMORY
Use the "in memory" backend.
static Database::Internal * database_factory(int fd, int flags)
Helper factory function.
static void open_stub(WritableDatabase &db, string_view file, int flags)
const int DB_BACKEND_STUB
Open a stub database file.
const int DB_BACKEND_HONEY
Use the honey backend.
const int DB_BACKEND_GLASS
Use the glass backend.
static void open_stub(Database &db, string_view file)
Provides wrappers with POSIXy semantics.
Convert types to std::string.
Define preprocessor symbols for the library version.