xapian-core
1.4.26
|
Helper functions for database handling. More...
#include <cerrno>
#include <cstdlib>
#include <fstream>
#include <string>
#include "fileutils.h"
#include "safesysstat.h"
#include "safeunistd.h"
#include "str.h"
#include "xapian/error.h"
Go to the source code of this file.
Functions | |
int | test_if_single_file_db (const struct stat &sb, const std::string &path, int *fd_ptr) |
Probe if a path is a single-file database. More... | |
template<typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 > | |
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. More... | |
Helper functions for database handling.
Definition in file databasehelpers.h.
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.
Implemented as a template with separate actions for each database type.
Definition at line 64 of file databasehelpers.h.
References resolve_relative_path(), and Xapian::Internal::str().
Referenced by Xapian::check_stub(), and Xapian::open_stub().
int test_if_single_file_db | ( | const struct stat & | sb, |
const std::string & | path, | ||
int * | fd_ptr | ||
) |
Probe if a path is a single-file database.
sb | struct statbuf from calling stat() on path |
path | path to probe |
fd_ptr | used to return fd open of path (unless BACKEND_UNKNOWN is returned) |
Definition at line 45 of file databasehelpers.cc.
References Assert, BACKEND_GLASS, BACKEND_UNKNOWN, close(), GLASS_MIN_BLOCKSIZE, io_read(), O_BINARY, posixy_open, and S_ISREG.
Referenced by Xapian::Database::check_(), and Xapian::Database::Database().