1 /** @file backendmanager_remoteprog.cc
2 * @brief BackendManager subclass for remoteprog databases.
4 /* Copyright (C) 2007,2008,2009 Olly Betts
5 * Copyright (C) 2008 Lemur Consulting Ltd
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.
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.
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 USA
24 #include "backendmanager_remoteprog.h"
29 # include <valgrind/memcheck.h>
35 BackendManagerRemoteProg::get_dbtype() const
37 return "remoteprog_" + remote_type
;
41 BackendManagerRemoteProg::do_get_database(const vector
<string
> & files
)
43 // Default to a long (5 minute) timeout so that tests won't fail just
44 // because the host is slow or busy.
45 return BackendManagerRemoteProg::get_remote_database(files
, 300000);
48 Xapian::WritableDatabase
49 BackendManagerRemoteProg::get_writable_database(const string
& name
,
52 string args
= get_writable_database_args(name
, file
);
55 if (RUNNING_ON_VALGRIND
) {
56 args
.insert(0, XAPIAN_PROGSRV
" ");
57 return Xapian::Remote::open_writable("./runsrv", args
);
60 return Xapian::Remote::open_writable(XAPIAN_PROGSRV
, args
);
64 BackendManagerRemoteProg::get_remote_database(const vector
<string
> & files
,
67 string args
= get_remote_database_args(files
, timeout
);
70 if (RUNNING_ON_VALGRIND
) {
71 args
.insert(0, XAPIAN_PROGSRV
" ");
72 return Xapian::Remote::open("./runsrv", args
);
75 return Xapian::Remote::open(XAPIAN_PROGSRV
, args
);
79 BackendManagerRemoteProg::get_writable_database_as_database()
81 string args
= get_writable_database_as_database_args();
84 if (RUNNING_ON_VALGRIND
) {
85 args
.insert(0, XAPIAN_PROGSRV
" ");
86 return Xapian::Remote::open("./runsrv", args
);
89 return Xapian::Remote::open(XAPIAN_PROGSRV
, args
);
92 Xapian::WritableDatabase
93 BackendManagerRemoteProg::get_writable_database_again()
95 string args
= get_writable_database_again_args();
98 if (RUNNING_ON_VALGRIND
) {
99 args
.insert(0, XAPIAN_PROGSRV
" ");
100 return Xapian::Remote::open_writable("./runsrv", args
);
103 return Xapian::Remote::open_writable(XAPIAN_PROGSRV
, args
);