Browse files

Introduce client_basic.{h,cpp}, replacing client_common.h.

In addition to good code hygiene, this change reduces the number of implicit
include dependencies that including client_basic.h introduces, speeding up many
incremental builds.
  • Loading branch information...
1 parent 0f4e3a0 commit c9a849e2b10ad300e0fb4cf3198adfab269a461d @andy10gen andy10gen committed Dec 18, 2012
View
3 src/mongo/SConscript
@@ -268,7 +268,8 @@ env.StaticLibrary("coredb", [
'server_parameters',
'geoparser'])
-coreServerFiles = [ "db/common.cpp",
+coreServerFiles = [ "db/client_basic.cpp",
+ "db/common.cpp",
"util/net/miniwebserver.cpp",
"db/indexkey.cpp",
"db/stats/counters.cpp",
View
2 src/mongo/client/authentication_table_client.cpp
@@ -15,7 +15,7 @@
#include "mongo/client/authentication_table.h"
-#include "mongo/db/client_common.h"
+#include "mongo/db/client_basic.h"
#include "mongo/db/security.h"
namespace mongo {
View
2 src/mongo/client/authentication_table_server.cpp
@@ -15,7 +15,7 @@
#include "mongo/client/authentication_table.h"
-#include "mongo/db/client_common.h"
+#include "mongo/db/client_basic.h"
#include "mongo/db/security.h"
namespace mongo {
View
2 src/mongo/client/clientAndShell.cpp
@@ -18,7 +18,7 @@
#include "pch.h"
#include "mongo/util/assert_util.h"
#include "../db/cmdline.h"
-#include "../db/client_common.h"
+#include "../db/client_basic.h"
#include "../s/shard.h"
#include "../util/timer.h"
#include "clientOnly-private.h"
View
2 src/mongo/db/client.h
@@ -26,7 +26,7 @@
#include "mongo/pch.h"
-#include "mongo/db/client_common.h"
+#include "mongo/db/client_basic.h"
#include "mongo/db/d_concurrency.h"
#include "mongo/db/lasterror.h"
#include "mongo/db/lockstate.h"
View
62 src/mongo/db/client_basic.cpp
@@ -0,0 +1,62 @@
+/**
+* Copyright (C) 2008 10gen Inc.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Affero General Public License, version 3,
+* as published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Affero General Public License for more details.
+*
+* You should have received a copy of the GNU Affero General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "mongo/db/client_basic.h"
+
+#include "mongo/db/auth/authentication_session.h"
+#include "mongo/db/auth/authorization_manager.h"
+
+namespace mongo {
+
+ ClientBasic::ClientBasic(AbstractMessagingPort* messagingPort) : _messagingPort(messagingPort) {
+ }
+ ClientBasic::~ClientBasic() {}
+
+ AuthenticationSession* ClientBasic::getAuthenticationSession() {
+ return _authenticationSession.get();
+ }
+
+ void ClientBasic::resetAuthenticationSession(
+ AuthenticationSession* newSession) {
+
+ _authenticationSession.reset(newSession);
+ }
+
+ void ClientBasic::swapAuthenticationSession(
+ scoped_ptr<AuthenticationSession>& other) {
+
+ _authenticationSession.swap(other);
+ }
+
+ bool ClientBasic::hasAuthorizationManager() {
+ return _authorizationManager.get();
+ }
+
+ AuthorizationManager* ClientBasic::getAuthorizationManager() {
+ massert(16481,
+ "No AuthorizationManager has been set up for this connection",
+ hasAuthorizationManager());
+ return _authorizationManager.get();
+ }
+
+ void ClientBasic::setAuthorizationManager(AuthorizationManager* authorizationManager) {
+ massert(16477,
+ "An AuthorizationManager has already been set up for this connection",
+ hasAuthorizationManager());
+ _authorizationManager.reset(authorizationManager);
+ }
+
+} // namespace mongo
View
37 src/mongo/db/client_common.h → src/mongo/db/client_basic.h
@@ -1,5 +1,3 @@
-// client_common.h
-
/**
* Copyright (C) 2008 10gen Inc.
*
@@ -20,14 +18,14 @@
#include <boost/scoped_ptr.hpp>
-#include "mongo/db/auth/authentication_session.h"
-#include "mongo/db/auth/authorization_manager.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/net/message_port.h"
namespace mongo {
class AuthenticationInfo;
+ class AuthenticationSession;
+ class AuthorizationManager;
/**
* this is the base class for Client and ClientInfo
@@ -38,28 +36,17 @@ namespace mongo {
*/
class ClientBasic : boost::noncopyable {
public:
- virtual ~ClientBasic(){}
+ virtual ~ClientBasic();
virtual const AuthenticationInfo * getAuthenticationInfo() const = 0;
virtual AuthenticationInfo * getAuthenticationInfo() = 0;
- AuthenticationSession* getAuthenticationSession() { return _authenticationSession.get(); }
- void resetAuthenticationSession(AuthenticationSession* newSession) {
- _authenticationSession.reset(newSession);
- }
- void swapAuthenticationSession(boost::scoped_ptr<AuthenticationSession>& other) {
- _authenticationSession.swap(other);
- }
- AuthorizationManager* getAuthorizationManager() {
- massert(16481,
- "No AuthorizationManager has been set up for this connection",
- _authorizationManager != NULL);
- return _authorizationManager.get();
- }
- void setAuthorizationManager(AuthorizationManager* authorizationManager) {
- massert(16477,
- "An AuthorizationManager has already been set up for this connection",
- _authorizationManager == NULL);
- _authorizationManager.reset(authorizationManager);
- }
+ AuthenticationSession* getAuthenticationSession();
+ void resetAuthenticationSession(AuthenticationSession* newSession);
+ void swapAuthenticationSession(boost::scoped_ptr<AuthenticationSession>& other);
+
+ bool hasAuthorizationManager();
+ AuthorizationManager* getAuthorizationManager();
+ void setAuthorizationManager(AuthorizationManager* authorizationManager);
+
bool getIsLocalHostConnection() {
if (!hasRemote()) {
return false;
@@ -78,7 +65,7 @@ namespace mongo {
static bool hasCurrent();
protected:
- ClientBasic(AbstractMessagingPort* messagingPort) : _messagingPort(messagingPort) {}
+ ClientBasic(AbstractMessagingPort* messagingPort);
private:
boost::scoped_ptr<AuthenticationSession> _authenticationSession;
View
2 src/mongo/db/commands/server_status.cpp
@@ -21,7 +21,7 @@
#include "mongo/db/auth/action_set.h"
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/privilege.h"
-#include "mongo/db/client_common.h"
+#include "mongo/db/client_basic.h"
#include "mongo/db/cmdline.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/server_status.h"
View
4 src/mongo/db/mongod_v8.vcxproj
@@ -1877,7 +1877,7 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<ClInclude Include="btreeposition.h" />
<ClInclude Include="btree_stats.h" />
<ClInclude Include="cc_by_loc.h" />
- <ClInclude Include="client_common.h" />
+ <ClInclude Include="client_basic.h" />
<ClInclude Include="cloner.h" />
<ClInclude Include="collection.h" />
<ClInclude Include="commands\fail_point_cmd.h" />
@@ -2225,4 +2225,4 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
View
4 src/mongo/db/mongod_v8.vcxproj.filters
@@ -2991,7 +2991,7 @@
<ClInclude Include="auth\principal_name.h">
<Filter>db\auth</Filter>
</ClInclude>
- <ClInclude Include="client_common.h">
+ <ClInclude Include="client_basic.h">
<Filter>db\Header Files\a to d</Filter>
</ClInclude>
<ClInclude Include="oplog.h">
@@ -3339,4 +3339,4 @@
<Filter>db\Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
-</Project>
+</Project>
View
2 src/mongo/db/security_commands.cpp
@@ -28,7 +28,7 @@
#include "mongo/db/auth/principal.h"
#include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/privilege_set.h"
-#include "mongo/db/client_common.h"
+#include "mongo/db/client_basic.h"
#include "mongo/db/commands.h"
#include "mongo/db/db.h"
#include "mongo/db/dbhelpers.h"
View
2 src/mongo/db/security_common.cpp
@@ -36,7 +36,7 @@
#include "security_common.h"
#include "commands.h"
#include "../util/md5.hpp"
-#include "client_common.h"
+#include "client_basic.h"
#include "mongo/client/dbclientinterface.h"
View
4 src/mongo/dbtests/test.vcxproj
@@ -558,7 +558,7 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<ClInclude Include="..\db\btree_stats.h" />
<ClInclude Include="..\db\cc_by_loc.h" />
<ClInclude Include="..\db\client.h" />
- <ClInclude Include="..\db\client_common.h" />
+ <ClInclude Include="..\db\client_basic.h" />
<ClInclude Include="..\db\cloner.h" />
<ClInclude Include="..\db\collection.h" />
<ClInclude Include="..\db\commands\server_status.h" />
@@ -1746,4 +1746,4 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
View
4 src/mongo/dbtests/test.vcxproj.filters
@@ -897,7 +897,7 @@
<ClInclude Include="..\db\client.h">
<Filter>db\Header Files\a to d</Filter>
</ClInclude>
- <ClInclude Include="..\db\client_common.h">
+ <ClInclude Include="..\db\client_basic.h">
<Filter>db\Header Files\a to d</Filter>
</ClInclude>
<ClInclude Include="..\db\cloner.h">
@@ -2452,4 +2452,4 @@
<Filter>db\auth</Filter>
</None>
</ItemGroup>
-</Project>
+</Project>
View
2 src/mongo/s/client_info.h
@@ -19,7 +19,7 @@
#include "mongo/pch.h"
-#include "mongo/db/client_common.h"
+#include "mongo/db/client_basic.h"
#include "mongo/db/security.h"
#include "mongo/s/chunk.h"
#include "mongo/s/writeback_listener.h"
View
4 src/mongo/shell/mongo.vcxproj
@@ -1203,7 +1203,7 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<ClInclude Include="..\client\undef_macros.h" />
<ClInclude Include="..\db\client.h" />
<ClInclude Include="..\db\clientcursor.h" />
- <ClInclude Include="..\db\client_common.h" />
+ <ClInclude Include="..\db\client_basic.h" />
<ClInclude Include="..\db\cloner.h" />
<ClInclude Include="..\db\cmdline.h" />
<ClInclude Include="..\db\commands.h" />
@@ -1320,4 +1320,4 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
View
6 src/mongo/shell/mongo.vcxproj.filters
@@ -805,7 +805,7 @@
<ClInclude Include="..\db\client.h">
<Filter>db\Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\db\client_common.h">
+ <ClInclude Include="..\db\client_basic.h">
<Filter>db\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\db\clientcursor.h">
@@ -943,7 +943,7 @@
<ClInclude Include="..\db\client.h">
<Filter>db\Header</Filter>
</ClInclude>
- <ClInclude Include="..\db\client_common.h">
+ <ClInclude Include="..\db\client_basic.h">
<Filter>db\Header</Filter>
</ClInclude>
<ClInclude Include="..\db\clientcursor.h">
@@ -1427,4 +1427,4 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
-</Project>
+</Project>
View
4 src/mongo/shell/mongo_v8.vcxproj
@@ -1658,7 +1658,7 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<ClInclude Include="..\client\undef_macros.h" />
<ClInclude Include="..\db\client.h" />
<ClInclude Include="..\db\clientcursor.h" />
- <ClInclude Include="..\db\client_common.h" />
+ <ClInclude Include="..\db\client_basic.h" />
<ClInclude Include="..\db\cloner.h" />
<ClInclude Include="..\db\cmdline.h" />
<ClInclude Include="..\db\commands.h" />
@@ -1774,4 +1774,4 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
View
6 src/mongo/shell/mongo_v8.vcxproj.filters
@@ -1246,7 +1246,7 @@
<ClInclude Include="..\db\client.h">
<Filter>db\Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\db\client_common.h">
+ <ClInclude Include="..\db\client_basic.h">
<Filter>db\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\db\clientcursor.h">
@@ -1384,7 +1384,7 @@
<ClInclude Include="..\db\client.h">
<Filter>db\Header</Filter>
</ClInclude>
- <ClInclude Include="..\db\client_common.h">
+ <ClInclude Include="..\db\client_basic.h">
<Filter>db\Header</Filter>
</ClInclude>
<ClInclude Include="..\db\clientcursor.h">
@@ -2354,4 +2354,4 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
-</Project>
+</Project>

0 comments on commit c9a849e

Please sign in to comment.