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.cpp | |
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.cpp')
-rw-r--r-- | src/mongo/db/commands.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index ff0a04fcfa8..045e475568f 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -105,16 +105,16 @@ namespace mongo { if( web ) ss << "</a>"; ss << "</td>\n"; ss << "<td>"; - int l = locktype(); - //if( l == NONE ) ss << "N "; - if( l == READ ) ss << "R "; - else if( l == WRITE ) ss << "W "; + if (isWriteCommandForConfigServer()) { + ss << "W "; + } + else { + ss << "R "; + } if( slaveOk() ) ss << "S "; if( adminOnly() ) ss << "A"; - if( lockGlobally() ) - ss << " lockGlobally "; ss << "</td>"; ss << "<td>"; if( helpStr != "no help defined" ) { @@ -197,13 +197,6 @@ namespace mongo { return i->second; } - Command::LockType Command::locktype( const string& name ) { - Command * c = findCommand( name ); - if ( ! c ) - return WRITE; - return c->locktype(); - } - bool Command::appendCommandStatus(BSONObjBuilder& result, const Status& status) { appendCommandStatus(result, status.isOK(), status.reason()); BSONObj tmp = result.asTempObj(); @@ -335,7 +328,7 @@ namespace mongo { public: PoolFlushCmd() : Command( "connPoolSync" , false , "connpoolsync" ) {} virtual void help( stringstream &help ) const { help<<"internal"; } - virtual LockType locktype() const { return NONE; } + virtual bool isWriteCommandForConfigServer() const { return false; } virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) { @@ -359,7 +352,7 @@ namespace mongo { public: PoolStats() : Command( "connPoolStats" ) {} virtual void help( stringstream &help ) const { help<<"stats about connection pool"; } - virtual LockType locktype() const { return NONE; } + virtual bool isWriteCommandForConfigServer() const { return false; } virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) { |