#include <commands.h>
Public Types | |
enum | LockType { READ = -1, NONE = 0, WRITE = 1 } |
Public Member Functions | |
virtual bool | adminOnly () const |
Command (const char *_name, bool webUI=false, const char *oldName=0) | |
virtual void | help (stringstream &help) const |
void | htmlHelp (stringstream &) const |
virtual bool | localHostOnlyIfNoAuth (const BSONObj &cmdObj) |
virtual LockType | locktype () const =0 |
virtual bool | logTheOp () |
virtual bool | requiresAuth () |
virtual bool | run (const string &db, BSONObj &cmdObj, string &errmsg, BSONObjBuilder &result, bool fromRepl)=0 |
virtual bool | slaveOk () const =0 |
virtual bool | slaveOverrideOk () |
virtual | ~Command () |
Static Public Member Functions | |
static const map< string, Command * > * | commandsByBestName () |
static Command * | findCommand (const string &name) |
static LockType | locktype (const string &name) |
static bool | runAgainstRegistered (const char *ns, BSONObj &jsobj, BSONObjBuilder &anObjBuilder) |
static const map< string, Command * > * | webCommands () |
Public Attributes | |
const string | name |
Protected Member Functions | |
BSONObj | getQuery (const BSONObj &cmdObj) |
Static Protected Member Functions | |
static void | logIfSlow (const Timer &cmdTimer, const string &msg) |
Static Protected Attributes | |
static map< string, Command * > * | _commands |
static map< string, Command * > * | _commandsByBestName |
static map< string, Command * > * | _webCommands |
mongodb "commands" (sent via db.$cmd.findOne(...)) subclass to make a command. define a singleton object for it.
Definition at line 34 of file commands.h.
Definition at line 37 of file commands.h.
mongo::Command::Command | ( | const char * | _name, | |
bool | webUI = false , |
|||
const char * | oldName = 0 | |||
) |
webUI | expose the command in the web ui as localhost:28017/<name> | |
oldName | an optional old, deprecated name for the command |
virtual mongo::Command::~Command | ( | ) | [inline, virtual] |
Definition at line 103 of file commands.h.
virtual bool mongo::Command::adminOnly | ( | ) | const [inline, virtual] |
Reimplemented in mongo::ReplSetCommand.
Definition at line 59 of file commands.h.
static const map<string,Command*>* mongo::Command::commandsByBestName | ( | ) | [inline, static] |
Definition at line 121 of file commands.h.
static Command* mongo::Command::findCommand | ( | const string & | name | ) | [static] |
Definition at line 106 of file commands.h.
virtual void mongo::Command::help | ( | stringstream & | help | ) | const [virtual] |
Reimplemented in mongo::ReplSetCommand.
void mongo::Command::htmlHelp | ( | stringstream & | ) | const |
virtual bool mongo::Command::localHostOnlyIfNoAuth | ( | const BSONObj & | cmdObj | ) | [inline, virtual] |
Definition at line 70 of file commands.h.
static LockType mongo::Command::locktype | ( | const string & | name | ) | [static] |
virtual LockType mongo::Command::locktype | ( | ) | const [pure virtual] |
Implemented in mongo::ReplSetCommand.
static void mongo::Command::logIfSlow | ( | const Timer & | cmdTimer, | |
const string & | msg | |||
) | [static, protected] |
virtual bool mongo::Command::logTheOp | ( | ) | [inline, virtual] |
Reimplemented in mongo::ReplSetCommand.
Definition at line 89 of file commands.h.
virtual bool mongo::Command::requiresAuth | ( | ) | [inline, virtual] |
Definition at line 96 of file commands.h.
virtual bool mongo::Command::run | ( | const string & | db, | |
BSONObj & | cmdObj, | |||
string & | errmsg, | |||
BSONObjBuilder & | result, | |||
bool | fromRepl | |||
) | [pure virtual] |
static bool mongo::Command::runAgainstRegistered | ( | const char * | ns, | |
BSONObj & | jsobj, | |||
BSONObjBuilder & | anObjBuilder | |||
) | [static] |
virtual bool mongo::Command::slaveOk | ( | ) | const [pure virtual] |
Implemented in mongo::ReplSetCommand.
virtual bool mongo::Command::slaveOverrideOk | ( | ) | [inline, virtual] |
Definition at line 80 of file commands.h.
static const map<string,Command*>* mongo::Command::webCommands | ( | ) | [inline, static] |
Definition at line 122 of file commands.h.
map<string,Command*>* mongo::Command::_commands [static, protected] |
Definition at line 116 of file commands.h.
map<string,Command*>* mongo::Command::_commandsByBestName [static, protected] |
Definition at line 117 of file commands.h.
map<string,Command*>* mongo::Command::_webCommands [static, protected] |
Definition at line 118 of file commands.h.
const string mongo::Command::name |
Definition at line 39 of file commands.h.