LCOV - code coverage report
Current view: top level - backends - databasereplicator.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 10 10 100.0 %
Date: 2011-08-21 Functions: 2 4 50.0 %
Branches: 6 12 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file databasereplicator.cc
       2                 :            :  * @brief Support class for database replication.
       3                 :            :  */
       4                 :            : /* Copyright 2008 Lemur Consulting Ltd
       5                 :            :  * Copyright 2009,2010 Olly Betts
       6                 :            :  *
       7                 :            :  * This program is free software; you can redistribute it and/or
       8                 :            :  * modify it under the terms of the GNU General Public License as
       9                 :            :  * published by the Free Software Foundation; either version 2 of the
      10                 :            :  * License, or (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This program is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :            :  * GNU General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU General Public License
      18                 :            :  * along with this program; if not, write to the Free Software
      19                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
      20                 :            :  * USA
      21                 :            :  */
      22                 :            : 
      23                 :            : #include <config.h>
      24                 :            : 
      25                 :            : #include "databasereplicator.h"
      26                 :            : 
      27                 :            : #include "xapian/error.h"
      28                 :            : #include "xapian/version.h" // For XAPIAN_HAS_XXX_BACKEND.
      29                 :            : 
      30                 :            : #include "debuglog.h"
      31                 :            : #include "utils.h"
      32                 :            : 
      33                 :            : #ifdef XAPIAN_HAS_BRASS_BACKEND
      34                 :            : # include "brass/brass_databasereplicator.h"
      35                 :            : #endif
      36                 :            : #ifdef XAPIAN_HAS_CHERT_BACKEND
      37                 :            : # include "chert/chert_databasereplicator.h"
      38                 :            : #endif
      39                 :            : #ifdef XAPIAN_HAS_FLINT_BACKEND
      40                 :            : # include "flint/flint_databasereplicator.h"
      41                 :            : #endif
      42                 :            : 
      43                 :            : using namespace std;
      44                 :            : 
      45                 :            : namespace Xapian {
      46                 :            : 
      47                 :        193 : DatabaseReplicator::~DatabaseReplicator()
      48                 :            : {
      49 [ #  # ][ #  # ]:        193 : }
                 [ -  + ]
      50                 :            : 
      51                 :            : DatabaseReplicator *
      52                 :        193 : DatabaseReplicator::open(const string & path)
      53                 :            : {
      54                 :            :     LOGCALL_STATIC_VOID(DB, "DatabaseReplicator::DatabaseReplicator", path);
      55                 :            : 
      56                 :            : #ifdef XAPIAN_HAS_CHERT_BACKEND
      57         [ +  + ]:        193 :     if (file_exists(path + "/iamchert")) {
      58                 :         66 :         return new ChertDatabaseReplicator(path);
      59                 :            :     }
      60                 :            : #endif
      61                 :            : 
      62                 :            : #ifdef XAPIAN_HAS_FLINT_BACKEND
      63         [ +  + ]:        127 :     if (file_exists(path + "/iamflint")) {
      64                 :         68 :         return new FlintDatabaseReplicator(path);
      65                 :            :     }
      66                 :            : #endif
      67                 :            : 
      68                 :            : #ifdef XAPIAN_HAS_BRASS_BACKEND
      69         [ +  - ]:         59 :     if (file_exists(path + "/iambrass")) {
      70                 :         59 :         return new BrassDatabaseReplicator(path);
      71                 :            :     }
      72                 :            : #endif
      73                 :            : 
      74                 :        193 :     throw DatabaseOpeningError("Couldn't detect type of database: " + path);
      75                 :            : }
      76                 :            : 
      77                 :            : }

Generated by: LCOV version 1.8