diff options
Diffstat (limited to 'db/commands.h')
-rw-r--r-- | db/commands.h | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/db/commands.h b/db/commands.h index e0719a7e00d..47a49e75a71 100644 --- a/db/commands.h +++ b/db/commands.h @@ -19,47 +19,47 @@ namespace mongo { -class BSONObj; -class BSONObjBuilder; + class BSONObj; + class BSONObjBuilder; // db "commands" (sent via db.$cmd.findOne(...)) // subclass to make a command. -class Command { -public: - string name; + class Command { + public: + string name; - /* run the given command - implement this... + /* run the given command + implement this... - fromRepl - command is being invoked as part of replication syncing. In this situation you - normally do not want to log the command to the local oplog. + fromRepl - command is being invoked as part of replication syncing. In this situation you + normally do not want to log the command to the local oplog. - return value is true if succeeded. if false, set errmsg text. - */ - virtual bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) = 0; + return value is true if succeeded. if false, set errmsg text. + */ + virtual bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) = 0; - /* Return true if only the admin ns has privileges to run this command. */ - virtual bool adminOnly() { - return false; - } + /* Return true if only the admin ns has privileges to run this command. */ + virtual bool adminOnly() { + return false; + } - /* Return true if slaves of a replication pair are allowed to execute the command - (the command directly from a client -- if fromRepl, always allowed). - */ - virtual bool slaveOk() = 0; + /* Return true if slaves of a replication pair are allowed to execute the command + (the command directly from a client -- if fromRepl, always allowed). + */ + virtual bool slaveOk() = 0; - /* Override and return true to if true,log the operation (logOp()) to the replication log. - (not done if fromRepl of course) + /* Override and return true to if true,log the operation (logOp()) to the replication log. + (not done if fromRepl of course) - Note if run() returns false, we do NOT log. - */ - virtual bool logTheOp() { - return false; - } + Note if run() returns false, we do NOT log. + */ + virtual bool logTheOp() { + return false; + } - Command(const char *_name); -}; + Command(const char *_name); + }; -bool runCommandAgainstRegistered(const char *ns, BSONObj& jsobj, BSONObjBuilder& anObjBuilder); + bool runCommandAgainstRegistered(const char *ns, BSONObj& jsobj, BSONObjBuilder& anObjBuilder); } // namespace mongo |