summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/database_holder.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/catalog/database_holder.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/catalog/database_holder.h')
-rw-r--r--src/mongo/db/catalog/database_holder.h94
1 files changed, 47 insertions, 47 deletions
diff --git a/src/mongo/db/catalog/database_holder.h b/src/mongo/db/catalog/database_holder.h
index 3238b886f01..ce99747937b 100644
--- a/src/mongo/db/catalog/database_holder.h
+++ b/src/mongo/db/catalog/database_holder.h
@@ -37,62 +37,62 @@
namespace mongo {
- class Database;
- class OperationContext;
+class Database;
+class OperationContext;
+
+/**
+ * Registry of opened databases.
+ */
+class DatabaseHolder {
+public:
+ DatabaseHolder() = default;
/**
- * Registry of opened databases.
+ * Retrieves an already opened database or returns NULL. Must be called with the database
+ * locked in at least IS-mode.
*/
- class DatabaseHolder {
- public:
- DatabaseHolder() = default;
+ Database* get(OperationContext* txn, StringData ns) const;
- /**
- * Retrieves an already opened database or returns NULL. Must be called with the database
- * locked in at least IS-mode.
- */
- Database* get(OperationContext* txn, StringData ns) const;
-
- /**
- * Retrieves a database reference if it is already opened, or opens it if it hasn't been
- * opened/created yet. Must be called with the database locked in X-mode.
- *
- * @param justCreated Returns whether the database was newly created (true) or it already
- * existed (false). Can be NULL if this information is not necessary.
- */
- Database* openDb(OperationContext* txn, StringData ns, bool* justCreated = NULL);
+ /**
+ * Retrieves a database reference if it is already opened, or opens it if it hasn't been
+ * opened/created yet. Must be called with the database locked in X-mode.
+ *
+ * @param justCreated Returns whether the database was newly created (true) or it already
+ * existed (false). Can be NULL if this information is not necessary.
+ */
+ Database* openDb(OperationContext* txn, StringData ns, bool* justCreated = NULL);
- /**
- * Closes the specified database. Must be called with the database locked in X-mode.
- */
- void close(OperationContext* txn, StringData ns);
+ /**
+ * Closes the specified database. Must be called with the database locked in X-mode.
+ */
+ void close(OperationContext* txn, StringData ns);
- /**
- * Closes all opened databases. Must be called with the global lock acquired in X-mode.
- *
- * @param result Populated with the names of the databases, which were closed.
- * @param force Force close even if something underway - use at shutdown
- */
- bool closeAll(OperationContext* txn, BSONObjBuilder& result, bool force);
+ /**
+ * Closes all opened databases. Must be called with the global lock acquired in X-mode.
+ *
+ * @param result Populated with the names of the databases, which were closed.
+ * @param force Force close even if something underway - use at shutdown
+ */
+ bool closeAll(OperationContext* txn, BSONObjBuilder& result, bool force);
- /**
- * Retrieves the names of all currently opened databases. Does not require locking, but it
- * is not guaranteed that the returned set of names will be still valid unless a global
- * lock is held, which would prevent database from disappearing or being created.
- */
- void getAllShortNames( std::set<std::string>& all ) const {
- stdx::lock_guard<SimpleMutex> lk(_m);
- for( DBs::const_iterator j=_dbs.begin(); j!=_dbs.end(); ++j ) {
- all.insert( j->first );
- }
+ /**
+ * Retrieves the names of all currently opened databases. Does not require locking, but it
+ * is not guaranteed that the returned set of names will be still valid unless a global
+ * lock is held, which would prevent database from disappearing or being created.
+ */
+ void getAllShortNames(std::set<std::string>& all) const {
+ stdx::lock_guard<SimpleMutex> lk(_m);
+ for (DBs::const_iterator j = _dbs.begin(); j != _dbs.end(); ++j) {
+ all.insert(j->first);
}
+ }
- private:
- typedef StringMap<Database*> DBs;
+private:
+ typedef StringMap<Database*> DBs;
- mutable SimpleMutex _m;
- DBs _dbs;
- };
+ mutable SimpleMutex _m;
+ DBs _dbs;
+};
- DatabaseHolder& dbHolder();
+DatabaseHolder& dbHolder();
}