diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-06-11 17:39:09 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-06-13 09:47:22 -0400 |
commit | 15d292461279f3f5cfe077dd2b37a327d75d4c38 (patch) | |
tree | a012b7895e507c93d858a8882eb005dddf504f98 /src/mongo/db/catalog/database_holder.h | |
parent | d62e62464bd1bbe1b82c57240e27b1d1700472c4 (diff) | |
download | mongo-15d292461279f3f5cfe077dd2b37a327d75d4c38.tar.gz |
SERVER-13961 Convert most usages of LockState from TLS to OperationContext
Diffstat (limited to 'src/mongo/db/catalog/database_holder.h')
-rw-r--r-- | src/mongo/db/catalog/database_holder.h | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/src/mongo/db/catalog/database_holder.h b/src/mongo/db/catalog/database_holder.h index 007ed7a3871..5ffd4534744 100644 --- a/src/mongo/db/catalog/database_holder.h +++ b/src/mongo/db/catalog/database_holder.h @@ -49,50 +49,16 @@ namespace mongo { public: DatabaseHolder() : _m("dbholder"),_size(0) { } - bool __isLoaded( const std::string& ns , const std::string& path ) const { - SimpleMutex::scoped_lock lk(_m); - Paths::const_iterator x = _paths.find( path ); - if ( x == _paths.end() ) - return false; - const DBs& m = x->second; - - std::string db = _todb( ns ); - - DBs::const_iterator it = m.find(db); - return it != m.end(); - } - // must be write locked as otherwise isLoaded could go false->true on you - // in the background and you might not expect that. - bool _isLoaded( const std::string& ns , const std::string& path ) const { - Lock::assertWriteLocked(ns); - return __isLoaded(ns,path); - } - - Database * get( const std::string& ns , const std::string& path ) const { - SimpleMutex::scoped_lock lk(_m); - Lock::assertAtLeastReadLocked(ns); - Paths::const_iterator x = _paths.find( path ); - if ( x == _paths.end() ) - return 0; - const DBs& m = x->second; - std::string db = _todb( ns ); - DBs::const_iterator it = m.find(db); - if ( it != m.end() ) - return it->second; - return 0; - } + Database* get(OperationContext* txn, + const std::string& ns, + const std::string& path) const; Database* getOrCreate(OperationContext* txn, const std::string& ns, const std::string& path, bool& justCreated); - void erase( const std::string& ns , const std::string& path ) { - SimpleMutex::scoped_lock lk(_m); - verify( Lock::isW() ); - DBs& m = _paths[path]; - _size -= (int)m.erase( _todb( ns ) ); - } + void erase(OperationContext* txn, const std::string& ns, const std::string& path); /** @param force - force close even if something underway - use at shutdown */ bool closeAll(OperationContext* txn, |