backends/dbfactory_remote.cc

Go to the documentation of this file.
00001 /* dbfactory_remote.cc: Database factories for remote databases.
00002  *
00003  * Copyright (C) 2006,2007 Olly Betts
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License as
00007  * published by the Free Software Foundation; either version 2 of the
00008  * License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #include <config.h>
00021 
00022 #include <xapian/dbfactory.h>
00023 
00024 #include "progclient.h"
00025 #include "tcpclient.h"
00026 
00027 #include <string>
00028 
00029 using namespace std;
00030 
00031 namespace Xapian {
00032 
00033 Database
00034 Remote::open(const string &host, unsigned int port, Xapian::timeout timeout,
00035              Xapian::timeout connect_timeout)
00036 {
00037     DEBUGAPICALL_STATIC(Database, "Remote::open",
00038         host << ", " << port << ", " << timeout << ", " << connect_timeout);
00039     return Database(new TcpClient(host, port, timeout, connect_timeout, false));
00040 }
00041 
00042 WritableDatabase
00043 Remote::open_writable(const string &host, unsigned int port,
00044                       Xapian::timeout timeout, Xapian::timeout connect_timeout)
00045 {
00046     DEBUGAPICALL_STATIC(WritableDatabase, "Remote::open_writable",
00047         host << ", " << port << ", " << timeout << ", " << connect_timeout);
00048     return WritableDatabase(new TcpClient(host, port, timeout, connect_timeout, true));
00049 }
00050 
00051 Database
00052 Remote::open(const string &program, const string &args, Xapian::timeout timeout)
00053 {
00054     DEBUGAPICALL_STATIC(Database, "Remote::open",
00055         program << ", " << args << ", " << timeout);
00056     return Database(new ProgClient(program, args, timeout, false));
00057 }
00058 
00059 WritableDatabase
00060 Remote::open_writable(const string &program, const string &args,
00061                       Xapian::timeout timeout)
00062 {
00063     DEBUGAPICALL_STATIC(WritableDatabase, "Remote::open_writable",
00064         program << ", " << args << ", " << timeout);
00065     return WritableDatabase(new ProgClient(program, args, timeout, true));
00066 }
00067 
00068 }

Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.