diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-04-09 16:25:42 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-04-15 13:26:14 -0400 |
commit | 1249034444dc146eb6177fbe4845e593b807f84d (patch) | |
tree | 68eaa1b22e33c89e73f7fac06ce5644f5990825e /src/mongo/db/commands.h | |
parent | b3aaf2e5809e272367b0f60f66938d8bf712702c (diff) | |
download | mongo-1249034444dc146eb6177fbe4845e593b807f84d.tar.gz |
SERVER-13498 Get rid of LockStatus
This change removes all usages of LockStatus and pushes the lock
acquisitions to be inside the respective commands. This is a
refactoring on the way to per-document locking.
Diffstat (limited to 'src/mongo/db/commands.h')
-rw-r--r-- | src/mongo/db/commands.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index fcd1ae12ed0..e311b6b498f 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -61,10 +61,6 @@ namespace mutablebson { ResourcePattern parseResourcePattern(const std::string& dbname, const BSONObj& cmdObj) const; - // warning: isAuthorized uses the lockType() return values, and values are being passed - // around as ints so be careful as it isn't really typesafe and will need cleanup later - enum LockType { READ = -1 , NONE = 0 , WRITE = 1 }; - const string name; /* run the given command @@ -77,17 +73,15 @@ namespace mutablebson { */ virtual bool run(const string& db, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl = false ) = 0; - /* - note: logTheOp() MUST be false if READ - if NONE, can't use Client::Context setup - use with caution + /** + * This designation for the command is only used by the 'help' call and has nothing to do + * with lock acquisition. The reason we need to have it there is because + * SyncClusterConnection uses this to determine whether the command is update and needs to + * be sent to all three servers or just one. + * + * Eventually when SyncClusterConnection is refactored out, we can get rid of it. */ - virtual LockType locktype() const = 0; - - /** if true, lock globally instead of just the one database. by default only the one - database will be locked. - */ - virtual bool lockGlobally() const { return false; } + virtual bool isWriteCommandForConfigServer() const = 0; /* Return true if only the admin ns has privileges to run this command. */ virtual bool adminOnly() const { @@ -203,7 +197,6 @@ namespace mutablebson { BSONObj& jsobj, BSONObjBuilder& anObjBuilder, int queryOptions = 0); - static LockType locktype( const string& name ); static Command * findCommand( const string& name ); // For mongod and webserver. static void execCommand(Command* c, |