summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/database_holder.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-07-15 11:45:46 -0400
committerMathias Stearn <mathias@10gen.com>2014-07-28 11:59:20 -0400
commitece23f5a892d74360038f4f11f54c11e43f432cd (patch)
treecd341a4a139001394b355c13c08d723ea9ed7f00 /src/mongo/db/catalog/database_holder.cpp
parente3b915cec0233b4fcb5c1cd558cc57790b7b7386 (diff)
downloadmongo-ece23f5a892d74360038f4f11f54c11e43f432cd.tar.gz
SERVER-13635 Use StringData and StringMap in DBHolder
Diffstat (limited to 'src/mongo/db/catalog/database_holder.cpp')
-rw-r--r--src/mongo/db/catalog/database_holder.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/catalog/database_holder.cpp b/src/mongo/db/catalog/database_holder.cpp
index 9f58707f0b8..22c1b300537 100644
--- a/src/mongo/db/catalog/database_holder.cpp
+++ b/src/mongo/db/catalog/database_holder.cpp
@@ -55,12 +55,12 @@ namespace mongo {
}
Database* DatabaseHolder::get(OperationContext* txn,
- const std::string& ns) const {
+ const StringData& ns) const {
txn->lockState()->assertAtLeastReadLocked(ns);
SimpleMutex::scoped_lock lk(_m);
- const std::string db = _todb( ns );
+ const StringData db = _todb( ns );
DBs::const_iterator it = _dbs.find(db);
if ( it != _dbs.end() )
return it->second;
@@ -68,10 +68,10 @@ namespace mongo {
}
Database* DatabaseHolder::getOrCreate(OperationContext* txn,
- const string& ns,
+ const StringData& ns,
bool& justCreated) {
- const string dbname = _todb( ns );
+ const StringData dbname = _todb( ns );
invariant(txn->lockState()->isAtLeastReadLocked(dbname));
if (txn->lockState()->isWriteLocked() && FileAllocator::get()->hasFailed()) {
@@ -81,7 +81,7 @@ namespace mongo {
{
SimpleMutex::scoped_lock lk(_m);
{
- DBs::iterator i = _dbs.find(dbname);
+ DBs::const_iterator i = _dbs.find(dbname);
if( i != _dbs.end() ) {
justCreated = false;
return i->second;
@@ -122,7 +122,7 @@ namespace mongo {
}
void DatabaseHolder::erase(OperationContext* txn,
- const std::string& ns) {
+ const StringData& ns) {
invariant(txn->lockState()->isW());
SimpleMutex::scoped_lock lk(_m);
@@ -137,7 +137,7 @@ namespace mongo {
getDur().commitNow(txn); // bad things happen if we close a DB with outstanding writes
set< string > dbs;
- for ( map<string,Database*>::iterator i = _dbs.begin(); i != _dbs.end(); i++ ) {
+ for ( DBs::const_iterator i = _dbs.begin(); i != _dbs.end(); ++i ) {
dbs.insert( i->first );
}