LCOV - code coverage report
Current view: top level - backends - dbfactory_remote.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 7028d852e609 Lines: 8 8 100.0 %
Date: 2019-02-17 14:59:59 Functions: 4 4 100.0 %
Branches: 6 8 75.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file dbfactory_remote.cc
       2                 :            :  * @brief Database factories for remote databases.
       3                 :            :  */
       4                 :            : /* Copyright (C) 2006,2007,2008,2010,2011,2014 Olly Betts
       5                 :            :  *
       6                 :            :  * This program is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU General Public License as
       8                 :            :  * published by the Free Software Foundation; either version 2 of the
       9                 :            :  * License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This program is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this program; if not, write to the Free Software
      18                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      19                 :            :  */
      20                 :            : 
      21                 :            : #include <config.h>
      22                 :            : 
      23                 :            : #include <xapian/dbfactory.h>
      24                 :            : 
      25                 :            : #include "debuglog.h"
      26                 :            : #include "net/progclient.h"
      27                 :            : #include "net/remotetcpclient.h"
      28                 :            : 
      29                 :            : #include <string>
      30                 :            : 
      31                 :            : using namespace std;
      32                 :            : 
      33                 :            : namespace Xapian {
      34                 :            : 
      35                 :            : Database
      36                 :        269 : Remote::open(const string &host, unsigned int port, unsigned timeout_,
      37                 :            :              unsigned connect_timeout)
      38                 :            : {
      39                 :            :     LOGCALL_STATIC(API, Database, "Remote::open", host | port | timeout_ | connect_timeout);
      40         [ +  + ]:        269 :     RETURN(Database(new RemoteTcpClient(host, port, timeout_ * 1e-3,
      41                 :            :                                         connect_timeout * 1e-3, false, 0)));
      42                 :            : }
      43                 :            : 
      44                 :            : WritableDatabase
      45                 :         89 : Remote::open_writable(const string &host, unsigned int port,
      46                 :            :                       unsigned timeout_, unsigned connect_timeout,
      47                 :            :                       int flags)
      48                 :            : {
      49                 :            :     LOGCALL_STATIC(API, WritableDatabase, "Remote::open_writable", host | port | timeout_ | connect_timeout | flags);
      50         [ +  + ]:         89 :     RETURN(WritableDatabase(new RemoteTcpClient(host, port, timeout_ * 1e-3,
      51                 :            :                                                 connect_timeout * 1e-3, true,
      52                 :            :                                                 flags)));
      53                 :            : }
      54                 :            : 
      55                 :            : Database
      56                 :        273 : Remote::open(const string &program, const string &args,
      57                 :            :              unsigned timeout_)
      58                 :            : {
      59                 :            :     LOGCALL_STATIC(API, Database, "Remote::open", program | args | timeout_);
      60         [ +  - ]:        273 :     RETURN(Database(new ProgClient(program, args, timeout_ * 1e-3, false, 0)));
      61                 :            : }
      62                 :            : 
      63                 :            : WritableDatabase
      64                 :         85 : Remote::open_writable(const string &program, const string &args,
      65                 :            :                       unsigned timeout_, int flags)
      66                 :            : {
      67                 :            :     LOGCALL_STATIC(API, WritableDatabase, "Remote::open_writable", program | args | timeout_ | flags);
      68         [ +  - ]:         85 :     RETURN(WritableDatabase(new ProgClient(program, args,
      69                 :            :                                            timeout_ * 1e-3, true, flags)));
      70                 :            : }
      71                 :            : 
      72                 :            : }

Generated by: LCOV version 1.11