42 #ifdef XAPIAN_HAS_GLASS_BACKEND
45 #ifdef XAPIAN_HAS_CHERT_BACKEND
48 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
65 [&db](
const string& path) {
68 [&db](
const string& path) {
69 #ifdef XAPIAN_HAS_CHERT_BACKEND
75 [&db](
const string& path) {
76 #ifdef XAPIAN_HAS_GLASS_BACKEND
82 [&db](
const string& prog,
const string& args) {
83 #ifdef XAPIAN_HAS_REMOTE_BACKEND
90 [&db](
const string& host,
unsigned port) {
91 #ifdef XAPIAN_HAS_REMOTE_BACKEND
99 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
117 [&db, flags](
const string& path) {
120 [&db, &flags](
const string& path) {
124 [&db, &flags](
const string& path) {
128 [&db, flags](
const string& prog,
const string& args) {
129 #ifdef XAPIAN_HAS_REMOTE_BACKEND
137 [&db, flags](
const string& host,
unsigned port) {
138 #ifdef XAPIAN_HAS_REMOTE_BACKEND
156 Database::Database(
const string &path,
int flags)
160 int type = flags & DB_BACKEND_MASK_;
163 #ifdef XAPIAN_HAS_CHERT_BACKEND
170 #ifdef XAPIAN_HAS_GLASS_BACKEND
180 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
189 if (stat(path.c_str(), &statbuf) == -1) {
190 if (errno == ENOENT) {
197 if (
S_ISREG(statbuf.st_mode)) {
204 #ifdef XAPIAN_HAS_GLASS_BACKEND
221 #ifdef XAPIAN_HAS_CHERT_BACKEND
228 #ifdef XAPIAN_HAS_GLASS_BACKEND
236 string stub_file = path;
237 stub_file +=
"/XAPIANDB";
243 #ifndef XAPIAN_HAS_CHERT_BACKEND
248 #ifndef XAPIAN_HAS_GLASS_BACKEND
260 Database::Database(
int fd,
int flags)
266 #ifdef XAPIAN_HAS_GLASS_BACKEND
267 int type = flags & DB_BACKEND_MASK_;
281 #if defined XAPIAN_HAS_CHERT_BACKEND || \
282 defined XAPIAN_HAS_GLASS_BACKEND
283 #define HAVE_DISK_BACKEND
286 WritableDatabase::WritableDatabase(
const std::string &path,
int flags,
int block_size)
289 LOGCALL_CTOR(API,
"WritableDatabase", path|flags|block_size);
292 int type = flags & DB_BACKEND_MASK_;
294 flags &= ~DB_BACKEND_MASK_;
297 if (stat(path.c_str(), &statbuf) == -1) {
304 if (
S_ISREG(statbuf.st_mode)) {
316 #ifdef XAPIAN_HAS_CHERT_BACKEND
323 #ifdef XAPIAN_HAS_GLASS_BACKEND
333 string stub_file = path;
334 stub_file +=
"/XAPIANDB";
350 #ifdef XAPIAN_HAS_GLASS_BACKEND
355 #ifdef XAPIAN_HAS_CHERT_BACKEND
361 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
368 #ifndef HAVE_DISK_BACKEND
database class declarations
C++ class definition for chert database.
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
A writable chert database.
A backend designed for efficient indexing and retrieval, using compressed posting lists and a btree s...
A writable glass database.
A database held entirely in memory.
Indicates an attempt to access a database not present.
DatabaseOpeningError indicates failure to open a database.
This class is used to access a database, or a group of databases.
void add_database(const Database &database)
Add an existing database (or group of databases) to those accessed by this object.
std::vector< Xapian::Internal::intrusive_ptr< Internal > > internal
Indicates an attempt to use a feature which is unavailable.
InvalidArgumentError indicates an invalid parameter value was passed to the API.
This class provides read/write access to a database.
void add_database(const WritableDatabase &other)
Add shards from another WritableDatabase.
Constants in the Xapian namespace.
int test_if_single_file_db(const struct stat &sb, const string &path, int *fd_ptr)
Probe if a path is a single-file database.
Helper functions for database handling.
void read_stub_file(const std::string &file, A1 action_auto, A2 action_chert, A3 action_glass, A4 action_remote_prog, A5 action_remote_tcp, A6 action_inmemory)
Open, read and process a stub database file.
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.
API for working with Xapian databases.
C++ class definition for inmemory database access.
WritableDatabase open()
Construct a WritableDatabase object for a new, empty InMemory database.
WritableDatabase open_writable(const std::string &host, unsigned int port, useconds_t timeout=0, useconds_t connect_timeout=10000, int flags=0)
Construct a WritableDatabase object for update access to a remote database accessed via a TCP connect...
The Xapian namespace contains public interfaces for the Xapian library.
static void open_stub(Database &db, const string &file)
const int DB_BACKEND_INMEMORY
Use the "in memory" backend.
const int DB_BACKEND_CHERT
Use the chert backend.
const int DB_BACKEND_STUB
Open a stub database file.
static void open_stub(WritableDatabase &db, const string &file, int flags)
const int DB_BACKEND_GLASS
Use the glass backend.
Provides wrappers with POSIXy semantics.
Convert types to std::string.
Define preprocessor symbols for the library version.