Files
mongo/db/repl/replset_commands.cpp

65 lines
2.4 KiB
C++
Raw Normal View History

2010-04-14 17:30:23 -04:00
/**
* Copyright (C) 2008 10gen Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2010-04-27 15:27:52 -04:00
#include "pch.h"
2010-04-14 17:30:23 -04:00
#include "../cmdline.h"
#include "../commands.h"
2010-05-08 14:12:24 -04:00
#include "health.h"
2010-05-29 15:45:47 -04:00
#include "rs.h"
2010-04-23 17:35:05 -04:00
#include "rs_config.h"
2010-04-14 17:30:23 -04:00
namespace mongo {
2010-04-18 12:30:40 -04:00
/* commands in other files:
replSetHeartbeat - health.cpp
2010-05-08 14:12:24 -04:00
replSetInitiate - rs_mod.cpp
2010-04-22 18:43:37 -04:00
*/
2010-04-18 12:30:40 -04:00
2010-06-01 15:17:38 -04:00
class CmdReplSetGetStatus : public ReplSetCommand {
2010-04-14 17:30:23 -04:00
public:
2010-04-23 15:50:49 -04:00
virtual void help( stringstream &help ) const {
help << "Report status of a replica set from the POV of this server\n";
help << "{ replSetGetStatus : 1 }";
2010-04-25 16:13:21 -04:00
help << "\nhttp://www.mongodb.org/display/DOCS/Replica+Set+Commands";
2010-04-23 15:50:49 -04:00
}
2010-06-01 15:17:38 -04:00
CmdReplSetGetStatus() : ReplSetCommand("replSetGetStatus", true) { }
virtual bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
2010-06-01 15:17:38 -04:00
if( !check(errmsg, result) )
2010-04-20 12:29:00 -04:00
return false;
theReplSet->summarizeStatus(result);
2010-04-14 17:30:23 -04:00
return true;
}
} cmdReplSetGetStatus;
2010-06-01 15:17:38 -04:00
class CmdReplSetFreeze : public ReplSetCommand {
2010-04-25 16:13:21 -04:00
public:
virtual void help( stringstream &help ) const {
help << "Enable / disable failover for the set - locks current primary as primary even if issues occur.\nFor use during system maintenance.\n";
help << "{ replSetFreeze : <bool> }";
help << "\nhttp://www.mongodb.org/display/DOCS/Replica+Set+Commands";
}
2010-06-01 15:17:38 -04:00
CmdReplSetFreeze() : ReplSetCommand("replSetFreeze", true) { }
virtual bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
2010-06-01 15:17:38 -04:00
if( !check(errmsg, result) )
2010-04-25 16:13:21 -04:00
return false;
errmsg = "not yet implemented"; /*TODO*/
return false;
}
} cmdReplSetFreeze;
2010-04-14 17:30:23 -04:00
}