2009-10-27 20:58:27 +01:00
|
|
|
// clientOnly.cpp
|
|
|
|
|
|
|
|
/* Copyright 2009 10gen Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2009-12-22 22:42:49 +01:00
|
|
|
#include "stdafx.h"
|
2009-12-03 23:48:18 +01:00
|
|
|
#include "../client/dbclient.h"
|
|
|
|
#include "../db/dbhelpers.h"
|
2009-12-04 04:44:34 +01:00
|
|
|
#include "../db/cmdline.h"
|
2009-01-15 16:08:20 +01:00
|
|
|
|
|
|
|
namespace mongo {
|
|
|
|
|
2010-03-31 17:57:27 +02:00
|
|
|
CmdLine cmdLine;
|
|
|
|
|
2009-12-04 04:44:34 +01:00
|
|
|
const char * curNs = "in client mode";
|
2009-06-05 16:35:04 +02:00
|
|
|
|
2009-08-05 23:15:04 +02:00
|
|
|
bool dbexitCalled = false;
|
2009-01-15 16:08:20 +01:00
|
|
|
|
2009-08-05 22:00:27 +02:00
|
|
|
void dbexit( ExitCode returnCode, const char *whyMsg ) {
|
2009-08-05 23:15:04 +02:00
|
|
|
dbexitCalled = true;
|
2009-01-15 17:26:38 +01:00
|
|
|
out() << "dbexit called" << endl;
|
2009-01-15 16:08:20 +01:00
|
|
|
if ( whyMsg )
|
2009-01-15 17:26:38 +01:00
|
|
|
out() << " b/c " << whyMsg << endl;
|
|
|
|
out() << "exiting" << endl;
|
2009-01-25 22:25:36 +01:00
|
|
|
::exit( returnCode );
|
2009-01-15 16:08:20 +01:00
|
|
|
}
|
2009-08-05 23:15:04 +02:00
|
|
|
|
|
|
|
bool inShutdown(){
|
|
|
|
return dbexitCalled;
|
|
|
|
}
|
2009-01-15 16:08:20 +01:00
|
|
|
|
2010-03-18 21:38:27 +01:00
|
|
|
void setupSignals(){
|
|
|
|
// maybe should do SIGPIPE here, not sure
|
|
|
|
}
|
|
|
|
|
2009-01-15 16:17:11 +01:00
|
|
|
string getDbContext() {
|
2009-01-15 16:08:20 +01:00
|
|
|
return "in client only mode";
|
|
|
|
}
|
2009-09-10 16:36:11 +02:00
|
|
|
|
|
|
|
bool haveLocalShardingInfo( const string& ns ){
|
|
|
|
return false;
|
|
|
|
}
|
2010-02-17 17:02:36 +01:00
|
|
|
|
|
|
|
DBClientBase * createDirectClient(){
|
|
|
|
uassert( 10256 , "no createDirectClient in clientOnly" , 0 );
|
|
|
|
return 0;
|
|
|
|
}
|
2009-12-22 22:42:49 +01:00
|
|
|
/*
|
2009-12-03 23:48:18 +01:00
|
|
|
auto_ptr<CursorIterator> Helpers::find( const char *ns , BSONObj query , bool requireIndex ){
|
2009-12-28 22:43:43 +01:00
|
|
|
uassert( 10000 , "Helpers::find can't be used in client" , 0 );
|
2009-12-22 22:42:49 +01:00
|
|
|
return auto_ptr<CursorIterator>(0);
|
2009-12-03 23:48:18 +01:00
|
|
|
}
|
2009-12-22 22:42:49 +01:00
|
|
|
*/
|
2009-01-15 16:08:20 +01:00
|
|
|
}
|