xapian-core  1.4.25
databasehelpers.cc File Reference

Helper functions for database handling. More...

#include <config.h>
#include "databasehelpers.h"
#include "backends.h"
#include "glass/glass_defs.h"
#include "io_utils.h"
#include "omassert.h"
#include "posixy_wrapper.h"
#include <algorithm>
#include <cstring>
#include <string>
#include <sys/types.h>
#include "safesysstat.h"
#include "safeunistd.h"
+ Include dependency graph for databasehelpers.cc:

Go to the source code of this file.


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. More...

Detailed Description

Helper functions for database handling.

Definition in file databasehelpers.cc.

Function Documentation

◆ test_if_single_file_db()

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.

sbstruct statbuf from calling stat() on path
pathpath to probe
fd_ptrused to return fd open of path (unless BACKEND_UNKNOWN is returned)
A BACKEND_* constant from backends.h:
  • BACKEND_UNKNOWN : unknown (could be a stub file)
  • BACKEND_GLASS : glass single file

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().