|
xapian-core
2.0.0
|
Helper functions for database handling. More...
#include <cerrno>#include <fstream>#include <string>#include <string_view>#include "fileutils.h"#include "parseint.h"#include "safesysstat.h"#include "safeunistd.h"#include "str.h"#include "xapian/error.h"
Include dependency graph for databasehelpers.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| int | test_if_single_file_db (int fd) |
| Probe if a file descriptor is a single-file database. More... | |
| 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 (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. More... | |
Helper functions for database handling.
Definition in file databasehelpers.h.
| 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.
Implemented as a template with separate actions for each database type.
Definition at line 80 of file databasehelpers.h.
References parse_unsigned(), 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 89 of file databasehelpers.cc.
References Assert, BACKEND_UNKNOWN, close(), GLASS_MIN_BLOCKSIZE, HONEY_MIN_DB_SIZE, O_BINARY, posixy_open, S_ISREG, and test_if_single_file_db_().
| int test_if_single_file_db | ( | int | fd | ) |
Probe if a file descriptor is a single-file database.
This function looks for a single-file database at the current file offset of fd, restoring the file offset afterwards.
| fd | The file descriptor to check |
Definition at line 79 of file databasehelpers.cc.
References BACKEND_UNKNOWN, pos, and test_if_single_file_db_().
Referenced by Xapian::Database::check_(), Xapian::Database::Database(), and Xapian::database_factory().