diff options
150 files changed, 402 insertions, 538 deletions
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp index a344f8d3fb8..f6bdd726006 100644 --- a/src/mongo/client/dbclient_rs.cpp +++ b/src/mongo/client/dbclient_rs.cpp @@ -32,7 +32,6 @@ #include "mongo/client/dbclient_rs.h" #include <memory> -#include <boost/shared_ptr.hpp> #include <utility> #include "mongo/bson/util/builder.h" @@ -46,7 +45,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::endl; using std::map; diff --git a/src/mongo/client/dbclient_rs.h b/src/mongo/client/dbclient_rs.h index ac2fd24f161..68481b34ec8 100644 --- a/src/mongo/client/dbclient_rs.h +++ b/src/mongo/client/dbclient_rs.h @@ -29,7 +29,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <utility> #include "mongo/client/dbclientinterface.h" @@ -40,7 +39,7 @@ namespace mongo { class ReplicaSetMonitor; class TagSet; struct ReadPreferenceSetting; - typedef boost::shared_ptr<ReplicaSetMonitor> ReplicaSetMonitorPtr; + typedef std::shared_ptr<ReplicaSetMonitor> ReplicaSetMonitorPtr; /** Use this class to connect to a replica set of servers. The class will manage checking for which server in a replica set is master, and do failover automatically. @@ -222,7 +221,7 @@ namespace mongo { * @throws DBException when an error occurred either when trying to connect to * a node that was thought to be ok or when an assertion happened. */ - DBClientConnection* selectNodeUsingTags(boost::shared_ptr<ReadPreferenceSetting> readPref); + DBClientConnection* selectNodeUsingTags(std::shared_ptr<ReadPreferenceSetting> readPref); /** * @return true if the last host used in the last slaveOk query is still in the @@ -277,7 +276,7 @@ namespace mongo { // if connection is primary, it is owned by _master so it is incorrect to return // it to the pool. std::unique_ptr<DBClientConnection> _lastSlaveOkConn; - boost::shared_ptr<ReadPreferenceSetting> _lastReadPref; + std::shared_ptr<ReadPreferenceSetting> _lastReadPref; double _so_timeout; diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp index a9fd94e7e6a..9b9ddd5b6e2 100644 --- a/src/mongo/client/parallel.cpp +++ b/src/mongo/client/parallel.cpp @@ -34,7 +34,6 @@ #include "mongo/client/parallel.h" -#include <boost/shared_ptr.hpp> #include "mongo/client/connpool.h" #include "mongo/client/constants.h" @@ -53,7 +52,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::list; using std::map; @@ -560,7 +559,7 @@ namespace mongo { void ParallelSortClusteredCursor::setupVersionAndHandleSlaveOk( PCStatePtr state, const ShardId& shardId, - boost::shared_ptr<Shard> primary, + std::shared_ptr<Shard> primary, const NamespaceString& ns, const string& vinfo, ChunkManagerPtr manager ) { @@ -1187,7 +1186,7 @@ namespace mongo { return _cursorMap.size(); } - boost::shared_ptr<Shard> ParallelSortClusteredCursor::getQueryShard() { + std::shared_ptr<Shard> ParallelSortClusteredCursor::getQueryShard() { return grid.shardRegistry()->findIfExists(_cursorMap.begin()->first); } @@ -1199,9 +1198,9 @@ namespace mongo { } } - boost::shared_ptr<Shard> ParallelSortClusteredCursor::getPrimary() { + std::shared_ptr<Shard> ParallelSortClusteredCursor::getPrimary() { if (isSharded()) - return boost::shared_ptr<Shard>(); + return std::shared_ptr<Shard>(); return _cursorMap.begin()->second.pcState->primary; } diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h index 25b1993631a..3e97b6c23ea 100644 --- a/src/mongo/client/parallel.h +++ b/src/mongo/client/parallel.h @@ -31,7 +31,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/namespace_string.h" #include "mongo/s/client/shard.h" @@ -62,7 +61,7 @@ namespace mongo { }; class DBClientCursor; - typedef boost::shared_ptr<DBClientCursor> DBClientCursorPtr; + typedef std::shared_ptr<DBClientCursor> DBClientCursorPtr; class ParallelConnectionState { public: @@ -77,7 +76,7 @@ namespace mongo { // Version information ChunkManagerPtr manager; - boost::shared_ptr<Shard> primary; + std::shared_ptr<Shard> primary; // Cursor status information long long count; @@ -91,7 +90,7 @@ namespace mongo { }; typedef ParallelConnectionState PCState; - typedef boost::shared_ptr<PCState> PCStatePtr; + typedef std::shared_ptr<PCState> PCStatePtr; class ParallelConnectionMetadata { public: @@ -123,7 +122,7 @@ namespace mongo { }; typedef ParallelConnectionMetadata PCMData; - typedef boost::shared_ptr<PCMData> PCMDataPtr; + typedef std::shared_ptr<PCMData> PCMDataPtr; /** * Runs a query in parallel across N servers, enforcing compatible chunk versions for queries @@ -188,13 +187,13 @@ namespace mongo { * Returns the single shard with an open cursor. * It is an error to call this if getNumQueryShards() > 1 */ - boost::shared_ptr<Shard> getQueryShard(); + std::shared_ptr<Shard> getQueryShard(); /** * Returns primary shard with an open cursor. * It is an error to call this if the collection is sharded. */ - boost::shared_ptr<Shard> getPrimary(); + std::shared_ptr<Shard> getPrimary(); DBClientCursorPtr getShardCursor(const ShardId& shardId); @@ -239,7 +238,7 @@ namespace mongo { */ void setupVersionAndHandleSlaveOk(PCStatePtr state /* in & out */, const ShardId& shardId, - boost::shared_ptr<Shard> primary /* in */, + std::shared_ptr<Shard> primary /* in */, const NamespaceString& ns, const std::string& vinfo, ChunkManagerPtr manager /* in */ ); @@ -355,7 +354,7 @@ namespace mongo { * @param conn optional connection to use. will use standard pooled if non-specified * @param useShardConn use ShardConnection */ - static boost::shared_ptr<CommandResult> spawnCommand( const std::string& server, + static std::shared_ptr<CommandResult> spawnCommand( const std::string& server, const std::string& db, const BSONObj& cmd, int options, diff --git a/src/mongo/client/remote_command_targeter_rs.h b/src/mongo/client/remote_command_targeter_rs.h index 253b0da7d2e..43f3ffd7be2 100644 --- a/src/mongo/client/remote_command_targeter_rs.h +++ b/src/mongo/client/remote_command_targeter_rs.h @@ -28,7 +28,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <string> #include <vector> @@ -58,7 +58,7 @@ namespace mongo { const std::string _rsName; // Monitor for this replica set - boost::shared_ptr<ReplicaSetMonitor> _rsMonitor; + std::shared_ptr<ReplicaSetMonitor> _rsMonitor; }; } // namespace mongo diff --git a/src/mongo/client/replica_set_monitor.cpp b/src/mongo/client/replica_set_monitor.cpp index 0b92969acc5..98cfde7af7b 100644 --- a/src/mongo/client/replica_set_monitor.cpp +++ b/src/mongo/client/replica_set_monitor.cpp @@ -32,7 +32,6 @@ #include "mongo/client/replica_set_monitor.h" #include <algorithm> -#include <boost/make_shared.hpp> #include <boost/thread.hpp> #include <boost/thread/condition.hpp> #include <limits> @@ -50,7 +49,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::numeric_limits; using std::set; using std::string; @@ -264,7 +263,7 @@ namespace { bool ReplicaSetMonitor::useDeterministicHostSelection = false; ReplicaSetMonitor::ReplicaSetMonitor(StringData name, const std::set<HostAndPort>& seeds) - : _state(boost::make_shared<SetState>(name, seeds)) { + : _state(std::make_shared<SetState>(name, seeds)) { log() << "starting new replica set monitor for replica set " << name << " with seeds "; @@ -360,7 +359,7 @@ namespace { boost::lock_guard<boost::mutex> lk(setsLock); ReplicaSetMonitorPtr& m = sets[name]; if (!m) { - m = boost::make_shared<ReplicaSetMonitor>(name, servers); + m = std::make_shared<ReplicaSetMonitor>(name, servers); } replicaSetMonitorWatcher.safeGo(); @@ -589,7 +588,7 @@ namespace { } ScanStatePtr Refresher::startNewScan(const SetState* set) { - const ScanStatePtr scan = boost::make_shared<ScanState>(); + const ScanStatePtr scan = std::make_shared<ScanState>(); // The heuristics we use in deciding the order to contact hosts are designed to find a // master as quickly as possible. This is because we can't use any hosts we find until diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h index 64b7a89274e..599cc187dc9 100644 --- a/src/mongo/client/replica_set_monitor.h +++ b/src/mongo/client/replica_set_monitor.h @@ -27,7 +27,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <set> #include <string> @@ -41,7 +40,7 @@ namespace mongo { class BSONObj; class ReplicaSetMonitor; struct ReadPreferenceSetting; - typedef boost::shared_ptr<ReplicaSetMonitor> ReplicaSetMonitorPtr; + typedef std::shared_ptr<ReplicaSetMonitor> ReplicaSetMonitorPtr; /** * Holds state about a replica set and provides a means to refresh the local view. @@ -145,7 +144,7 @@ namespace mongo { * it will return none. If createFromSeed is true, it will try to look up the last known * servers list for this set and will create a new monitor using that as the seed list. */ - static boost::shared_ptr<ReplicaSetMonitor> get(const std::string& name); + static std::shared_ptr<ReplicaSetMonitor> get(const std::string& name); /** * Returns all the currently tracked replica set names. @@ -191,8 +190,8 @@ namespace mongo { struct IsMasterReply; struct ScanState; struct SetState; - typedef boost::shared_ptr<ScanState> ScanStatePtr; - typedef boost::shared_ptr<SetState> SetStatePtr; + typedef std::shared_ptr<ScanState> ScanStatePtr; + typedef std::shared_ptr<SetState> SetStatePtr; // // FOR TESTING ONLY diff --git a/src/mongo/client/replica_set_monitor_test.cpp b/src/mongo/client/replica_set_monitor_test.cpp index 736e59f3f57..d2870739f1e 100644 --- a/src/mongo/client/replica_set_monitor_test.cpp +++ b/src/mongo/client/replica_set_monitor_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include <boost/make_shared.hpp> #include "mongo/client/replica_set_monitor.h" #include "mongo/client/replica_set_monitor_internal.h" @@ -64,7 +63,7 @@ namespace { // NOT something that non-test code should do. TEST(ReplicaSetMonitor, InitialState) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); ASSERT_EQUALS(state->name, "name"); ASSERT(state->seedNodes == basicSeedsSet); ASSERT(state->lastSeenMaster.empty()); @@ -247,7 +246,7 @@ namespace { } TEST(ReplicaSetMonitor, CheckAllSeedsSerial) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -287,7 +286,7 @@ namespace { } TEST(ReplicaSetMonitor, CheckAllSeedsParallel) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -337,7 +336,7 @@ namespace { } TEST(ReplicaSetMonitor, NoMasterInitAllUp) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -376,7 +375,7 @@ namespace { } TEST(ReplicaSetMonitor, MasterNotInSeeds_NoPrimaryInIsMaster) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -435,7 +434,7 @@ namespace { } TEST(ReplicaSetMonitor, MasterNotInSeeds_PrimaryInIsMaster) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -492,7 +491,7 @@ namespace { TEST(ReplicaSetMonitor, SlavesUsableEvenIfNoMaster) { std::set<HostAndPort> seeds; seeds.insert(HostAndPort("a")); - SetStatePtr state = boost::make_shared<SetState>("name", seeds); + SetStatePtr state = std::make_shared<SetState>("name", seeds); Refresher refresher(state); const ReadPreferenceSetting secondary(ReadPreference::SecondaryOnly, TagSet()); @@ -528,7 +527,7 @@ namespace { // Test multiple nodes that claim to be master (we use a last-wins policy) TEST(ReplicaSetMonitor, MultipleMasterLastNodeWins) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -583,7 +582,7 @@ namespace { // Test nodes disagree about who is in the set, master is source of truth TEST(ReplicaSetMonitor, MasterIsSourceOfTruth) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); BSONArray primaryHosts = BSON_ARRAY("a" << "b" << "d"); @@ -614,7 +613,7 @@ namespace { // Test multiple master nodes that disagree about set membership TEST(ReplicaSetMonitor, MultipleMastersDisagree) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); BSONArray hostsForSeed[3]; @@ -695,7 +694,7 @@ namespace { // Ensure getMatchingHost returns hosts even if scan is ongoing TEST(ReplicaSetMonitor, GetMatchingDuringScan) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); const ReadPreferenceSetting primaryOnly(ReadPreference::PrimaryOnly, TagSet()); @@ -746,8 +745,8 @@ namespace { // Ensure nothing breaks when out-of-band failedHost is called during scan TEST(ReplicaSetMonitor, OutOfBandFailedHost) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); - ReplicaSetMonitorPtr rsm = boost::make_shared<ReplicaSetMonitor>(state); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); + ReplicaSetMonitorPtr rsm = std::make_shared<ReplicaSetMonitor>(state); Refresher refresher = rsm->startOrContinueRefresh(); for (size_t i = 0; i != basicSeeds.size(); ++i) { @@ -784,7 +783,7 @@ namespace { // Newly elected primary with electionId >= maximum electionId seen by the Refresher TEST(ReplicaSetMonitorTests, NewPrimaryWithMaxElectionId) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -840,7 +839,7 @@ namespace { // Ignore electionId of secondaries TEST(ReplicaSetMonitorTests, IgnoreElectionIdFromSecondaries) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); set<HostAndPort> seen; @@ -879,7 +878,7 @@ namespace { // Stale Primary with obsolete electionId TEST(ReplicaSetMonitorTests, StalePrimaryWithObsoleteElectionId) { - SetStatePtr state = boost::make_shared<SetState>("name", basicSeedsSet); + SetStatePtr state = std::make_shared<SetState>("name", basicSeedsSet); Refresher refresher(state); const OID firstElectionId = OID::gen(); diff --git a/src/mongo/db/background.cpp b/src/mongo/db/background.cpp index 6c859d5d700..94969dba15d 100644 --- a/src/mongo/db/background.cpp +++ b/src/mongo/db/background.cpp @@ -32,7 +32,6 @@ #include "mongo/db/background.h" -#include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include <iostream> #include <string> @@ -45,7 +44,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; namespace { @@ -65,7 +64,7 @@ namespace { boost::condition_variable _noOpsInProg; }; - typedef StringMap<boost::shared_ptr<BgInfo> > BgInfoMap; + typedef StringMap<std::shared_ptr<BgInfo> > BgInfoMap; typedef BgInfoMap::const_iterator BgInfoMapIterator; boost::mutex m; @@ -91,7 +90,7 @@ namespace { } void recordBeginAndInsert(BgInfoMap* bgiMap, StringData key) { - boost::shared_ptr<BgInfo>& bgInfo = bgiMap->get(key); + std::shared_ptr<BgInfo>& bgInfo = bgiMap->get(key); if (!bgInfo) bgInfo.reset(new BgInfo); bgInfo->recordBegin(); @@ -110,8 +109,8 @@ namespace { BgInfoMap* bgiMap, StringData key) { - boost::shared_ptr<BgInfo> bgInfo = mapFindWithDefault( - *bgiMap, key, boost::shared_ptr<BgInfo>()); + std::shared_ptr<BgInfo> bgInfo = mapFindWithDefault( + *bgiMap, key, std::shared_ptr<BgInfo>()); if (!bgInfo) return; bgInfo->awaitNoBgOps(lk); diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp index 84ed9d7e99d..b624c0151f0 100644 --- a/src/mongo/db/catalog/index_create.cpp +++ b/src/mongo/db/catalog/index_create.cpp @@ -34,7 +34,6 @@ #include "mongo/db/catalog/index_create.h" -#include <boost/make_shared.hpp> #include "mongo/base/error_codes.h" #include "mongo/client/dbclientinterface.h" diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 4551380d44a..fa9d590b2e8 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -72,7 +72,7 @@ namespace mongo { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::endl; using std::set; diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index d8e575e1dcf..2c9a8704577 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <vector> #include "mongo/db/auth/action_set.h" @@ -57,7 +56,7 @@ namespace mongo { using boost::intrusive_ptr; using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::string; using std::stringstream; @@ -232,7 +231,7 @@ namespace mongo { // This does mongod-specific stuff like creating the input PlanExecutor and adding // it to the front of the pipeline if needed. - boost::shared_ptr<PlanExecutor> input = PipelineD::prepareCursorSource(txn, + std::shared_ptr<PlanExecutor> input = PipelineD::prepareCursorSource(txn, collection, pPipeline, pCtx); diff --git a/src/mongo/db/concurrency/lock_state_test.cpp b/src/mongo/db/concurrency/lock_state_test.cpp index fd0042fc12c..cb9aab0172a 100644 --- a/src/mongo/db/concurrency/lock_state_test.cpp +++ b/src/mongo/db/concurrency/lock_state_test.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <vector> #include "mongo/config.h" @@ -287,7 +286,7 @@ namespace { TEST(Locker, PerformanceLocker) { for (int numLockers = 1; numLockers <= 64; numLockers = numLockers * 2) { - std::vector<boost::shared_ptr<LockerForTests> > lockers(numLockers); + std::vector<std::shared_ptr<LockerForTests> > lockers(numLockers); for (int i = 0; i < numLockers; i++) { lockers[i].reset(new LockerForTests(MODE_S)); } diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 66c45f76dff..4cd250f2c15 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -35,7 +35,6 @@ #include <boost/thread/thread.hpp> #include <boost/filesystem/operations.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <fstream> #include <iostream> #include <limits> @@ -415,7 +414,7 @@ namespace mongo { // do not want connections to just hang if recovery takes a very long time. server->setupSockets(); - boost::shared_ptr<DbWebServer> dbWebServer; + std::shared_ptr<DbWebServer> dbWebServer; if (serverGlobalParams.isHttpInterfaceEnabled) { dbWebServer.reset(new DbWebServer(serverGlobalParams.bind_ip, serverGlobalParams.port + 1000, diff --git a/src/mongo/db/dbwebserver.cpp b/src/mongo/db/dbwebserver.cpp index dadf01d432d..73662327766 100644 --- a/src/mongo/db/dbwebserver.cpp +++ b/src/mongo/db/dbwebserver.cpp @@ -604,7 +604,7 @@ namespace { vector<DbWebHandler*> * DbWebHandler::_handlers = 0; - void webServerListenThread(boost::shared_ptr<DbWebServer> dbWebServer) { + void webServerListenThread(std::shared_ptr<DbWebServer> dbWebServer) { Client::initThread("websvr"); dbWebServer->initAndListen(); diff --git a/src/mongo/db/dbwebserver.h b/src/mongo/db/dbwebserver.h index 10ded265989..a7135601221 100644 --- a/src/mongo/db/dbwebserver.h +++ b/src/mongo/db/dbwebserver.h @@ -31,7 +31,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include <vector> @@ -132,7 +131,7 @@ namespace mongo { const std::unique_ptr<AdminAccess> _webUsers; }; - void webServerListenThread(boost::shared_ptr<DbWebServer> dbWebServer); + void webServerListenThread(std::shared_ptr<DbWebServer> dbWebServer); std::string prettyHostName(); diff --git a/src/mongo/db/exec/pipeline_proxy.cpp b/src/mongo/db/exec/pipeline_proxy.cpp index 18d551ee8fd..d7082cacdbc 100644 --- a/src/mongo/db/exec/pipeline_proxy.cpp +++ b/src/mongo/db/exec/pipeline_proxy.cpp @@ -30,7 +30,6 @@ #include "mongo/db/exec/pipeline_proxy.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/pipeline/document_source.h" #include "mongo/db/pipeline/expression_context.h" @@ -38,13 +37,13 @@ namespace mongo { using boost::intrusive_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::vector; const char* PipelineProxyStage::kStageType = "PIPELINE_PROXY"; PipelineProxyStage::PipelineProxyStage(intrusive_ptr<Pipeline> pipeline, - const boost::shared_ptr<PlanExecutor>& child, + const std::shared_ptr<PlanExecutor>& child, WorkingSet* ws) : _pipeline(pipeline) , _includeMetaData(_pipeline->getContext()->inShard) // send metadata to merger @@ -93,7 +92,7 @@ namespace mongo { const RecordId& dl, InvalidationType type) { // propagate to child executor if still in use - if (boost::shared_ptr<PlanExecutor> exec = _childExec.lock()) { + if (std::shared_ptr<PlanExecutor> exec = _childExec.lock()) { exec->invalidate(txn, dl, type); } } diff --git a/src/mongo/db/exec/pipeline_proxy.h b/src/mongo/db/exec/pipeline_proxy.h index 4de2f947a32..68a33c0170e 100644 --- a/src/mongo/db/exec/pipeline_proxy.h +++ b/src/mongo/db/exec/pipeline_proxy.h @@ -30,8 +30,6 @@ #include <boost/optional/optional.hpp> #include <boost/intrusive_ptr.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> #include "mongo/db/catalog/collection.h" #include "mongo/db/exec/plan_stage.h" @@ -47,7 +45,7 @@ namespace mongo { class PipelineProxyStage : public PlanStage { public: PipelineProxyStage(boost::intrusive_ptr<Pipeline> pipeline, - const boost::shared_ptr<PlanExecutor>& child, + const std::shared_ptr<PlanExecutor>& child, WorkingSet* ws); virtual PlanStage::StageState work(WorkingSetID* out); @@ -72,7 +70,7 @@ namespace mongo { * Return a shared pointer to the PlanExecutor that feeds the pipeline. The returned * pointer may be NULL. */ - boost::shared_ptr<PlanExecutor> getChildExecutor(); + std::shared_ptr<PlanExecutor> getChildExecutor(); // Returns empty PlanStageStats object virtual PlanStageStats* getStats(); @@ -98,7 +96,7 @@ namespace mongo { const boost::intrusive_ptr<Pipeline> _pipeline; std::vector<BSONObj> _stash; const bool _includeMetaData; - boost::weak_ptr<PlanExecutor> _childExec; + std::weak_ptr<PlanExecutor> _childExec; // Not owned by us. WorkingSet* _ws; diff --git a/src/mongo/db/index/2d_common.h b/src/mongo/db/index/2d_common.h index d237c18a1b2..d30b8cd07df 100644 --- a/src/mongo/db/index/2d_common.h +++ b/src/mongo/db/index/2d_common.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include <vector> @@ -39,7 +38,7 @@ namespace mongo { struct TwoDIndexingParams { std::string geo; std::vector<std::pair<std::string, int> > other; - boost::shared_ptr<GeoHashConverter> geoHashConverter; + std::shared_ptr<GeoHashConverter> geoHashConverter; }; } // namespace mongo diff --git a/src/mongo/db/matcher/expression_geo.h b/src/mongo/db/matcher/expression_geo.h index 59cc2a87ac5..01fa07bf08b 100644 --- a/src/mongo/db/matcher/expression_geo.h +++ b/src/mongo/db/matcher/expression_geo.h @@ -31,7 +31,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/geo/geometry_container.h" #include "mongo/db/matcher/expression.h" @@ -101,7 +100,7 @@ namespace mongo { private: BSONObj _rawObj; // Share ownership of our query with all of our clones - boost::shared_ptr<const GeoExpression> _query; + std::shared_ptr<const GeoExpression> _query; }; @@ -170,7 +169,7 @@ namespace mongo { private: BSONObj _rawObj; // Share ownership of our query with all of our clones - boost::shared_ptr<const GeoNearExpression> _query; + std::shared_ptr<const GeoNearExpression> _query; }; } // namespace mongo diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index befbfad2198..ff8a087a0ed 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -32,7 +32,6 @@ #include <boost/optional.hpp> #include <boost/intrusive_ptr.hpp> -#include <boost/shared_ptr.hpp> #include <boost/unordered_map.hpp> #include <deque> @@ -240,7 +239,7 @@ namespace mongo { // Add new methods as needed. }; - void injectMongodInterface(boost::shared_ptr<MongodInterface> mongod) { + void injectMongodInterface(std::shared_ptr<MongodInterface> mongod) { _mongod = mongod; } @@ -249,7 +248,7 @@ namespace mongo { virtual ~DocumentSourceNeedsMongod() {} // Gives subclasses access to a MongodInterface implementation - boost::shared_ptr<MongodInterface> _mongod; + std::shared_ptr<MongodInterface> _mongod; }; @@ -369,7 +368,7 @@ namespace mongo { */ static boost::intrusive_ptr<DocumentSourceCursor> create( const std::string& ns, - const boost::shared_ptr<PlanExecutor>& exec, + const std::shared_ptr<PlanExecutor>& exec, const boost::intrusive_ptr<ExpressionContext> &pExpCtx); /* @@ -413,7 +412,7 @@ namespace mongo { private: DocumentSourceCursor( const std::string& ns, - const boost::shared_ptr<PlanExecutor>& exec, + const std::shared_ptr<PlanExecutor>& exec, const boost::intrusive_ptr<ExpressionContext> &pExpCtx); void loadBatch(); @@ -429,7 +428,7 @@ namespace mongo { long long _docsAddedToBatches; // for _limit enforcement const std::string _ns; - boost::shared_ptr<PlanExecutor> _exec; // PipelineProxyStage holds a weak_ptr to this. + std::shared_ptr<PlanExecutor> _exec; // PipelineProxyStage holds a weak_ptr to this. }; @@ -491,7 +490,7 @@ namespace mongo { DocumentSourceGroup(const boost::intrusive_ptr<ExpressionContext> &pExpCtx); /// Spill groups map to disk and returns an iterator to the file. - boost::shared_ptr<Sorter<Value, Value>::Iterator> spill(); + std::shared_ptr<Sorter<Value, Value>::Iterator> spill(); // Only used by spill. Would be function-local if that were legal in C++03. class SpillSTLComparator; @@ -656,7 +655,7 @@ namespace mongo { }; // using list to enable removing arbitrary elements - typedef std::list<boost::shared_ptr<CursorAndConnection> > Cursors; + typedef std::list<std::shared_ptr<CursorAndConnection> > Cursors; DocumentSourceMergeCursors( const CursorIds& cursorIds, diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp index e02498c948c..d862663363d 100644 --- a/src/mongo/db/pipeline/document_source_cursor.cpp +++ b/src/mongo/db/pipeline/document_source_cursor.cpp @@ -30,7 +30,6 @@ #include "mongo/db/pipeline/document_source.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/catalog/database_holder.h" #include "mongo/db/db_raii.h" @@ -45,7 +44,7 @@ namespace mongo { using boost::intrusive_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::string; DocumentSourceCursor::~DocumentSourceCursor() { @@ -198,7 +197,7 @@ namespace mongo { } DocumentSourceCursor::DocumentSourceCursor(const string& ns, - const boost::shared_ptr<PlanExecutor>& exec, + const std::shared_ptr<PlanExecutor>& exec, const intrusive_ptr<ExpressionContext> &pCtx) : DocumentSource(pCtx) , _docsAddedToBatches(0) @@ -208,7 +207,7 @@ namespace mongo { intrusive_ptr<DocumentSourceCursor> DocumentSourceCursor::create( const string& ns, - const boost::shared_ptr<PlanExecutor>& exec, + const std::shared_ptr<PlanExecutor>& exec, const intrusive_ptr<ExpressionContext> &pExpCtx) { return new DocumentSourceCursor(ns, exec, pExpCtx); } diff --git a/src/mongo/db/pipeline/document_source_group.cpp b/src/mongo/db/pipeline/document_source_group.cpp index 8305225a467..aba16b65e17 100644 --- a/src/mongo/db/pipeline/document_source_group.cpp +++ b/src/mongo/db/pipeline/document_source_group.cpp @@ -40,7 +40,7 @@ namespace mongo { using boost::intrusive_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::pair; using std::vector; diff --git a/src/mongo/db/pipeline/document_source_merge_cursors.cpp b/src/mongo/db/pipeline/document_source_merge_cursors.cpp index ece870358f7..afe924d6a2f 100644 --- a/src/mongo/db/pipeline/document_source_merge_cursors.cpp +++ b/src/mongo/db/pipeline/document_source_merge_cursors.cpp @@ -30,7 +30,6 @@ #include "mongo/db/pipeline/document_source.h" -#include <boost/make_shared.hpp> namespace mongo { @@ -117,7 +116,7 @@ namespace mongo { // open each cursor and send message asking for a batch for (CursorIds::const_iterator it = _cursorIds.begin(); it !=_cursorIds.end(); ++it) { - _cursors.push_back(boost::make_shared<CursorAndConnection>( + _cursors.push_back(std::make_shared<CursorAndConnection>( it->first, pExpCtx->ns, it->second)); verify(_cursors.back()->connection->lazySupported()); _cursors.back()->cursor.initLazy(); // shouldn't block diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source_sort.cpp index 77fa0180332..f4e57d5c8ae 100644 --- a/src/mongo/db/pipeline/document_source_sort.cpp +++ b/src/mongo/db/pipeline/document_source_sort.cpp @@ -30,7 +30,6 @@ #include "mongo/db/pipeline/document_source.h" -#include <boost/make_shared.hpp> #include "mongo/db/jsobj.h" #include "mongo/db/pipeline/document.h" @@ -265,9 +264,9 @@ namespace mongo { }; void DocumentSourceSort::populateFromCursors(const vector<DBClientCursor*>& cursors) { - vector<boost::shared_ptr<MySorter::Iterator> > iterators; + vector<std::shared_ptr<MySorter::Iterator> > iterators; for (size_t i = 0; i < cursors.size(); i++) { - iterators.push_back(boost::make_shared<IteratorFromCursor>(this, cursors[i])); + iterators.push_back(std::make_shared<IteratorFromCursor>(this, cursors[i])); } _output.reset(MySorter::Iterator::merge(iterators, makeSortOptions(), Comparator(*this))); @@ -291,9 +290,9 @@ namespace mongo { }; void DocumentSourceSort::populateFromBsonArrays(const vector<BSONArray>& arrays) { - vector<boost::shared_ptr<MySorter::Iterator> > iterators; + vector<std::shared_ptr<MySorter::Iterator> > iterators; for (size_t i = 0; i < arrays.size(); i++) { - iterators.push_back(boost::make_shared<IteratorFromBsonArray>(this, arrays[i])); + iterators.push_back(std::make_shared<IteratorFromBsonArray>(this, arrays[i])); } _output.reset(MySorter::Iterator::merge(iterators, makeSortOptions(), Comparator(*this))); diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index 2709cc7f8d5..b6ddfdd7e12 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -30,8 +30,6 @@ #include "mongo/db/pipeline/pipeline_d.h" -#include <boost/make_shared.hpp> -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclientinterface.h" #include "mongo/db/catalog/collection.h" @@ -48,7 +46,7 @@ namespace mongo { using boost::intrusive_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::string; namespace { @@ -109,7 +107,7 @@ namespace { dynamic_cast<DocumentSourceNeedsMongod*>(sources[i].get()); if (needsMongod) { needsMongod->injectMongodInterface( - boost::make_shared<MongodImplementation>(pExpCtx)); + std::make_shared<MongodImplementation>(pExpCtx)); } } @@ -121,7 +119,7 @@ namespace { // on secondaries, this is needed. ShardedConnectionInfo::addHook(); } - return boost::shared_ptr<PlanExecutor>(); // don't need a cursor + return std::shared_ptr<PlanExecutor>(); // don't need a cursor } @@ -181,7 +179,7 @@ namespace { | QueryPlannerParams::INCLUDE_SHARD_FILTER | QueryPlannerParams::NO_BLOCKING_SORT ; - boost::shared_ptr<PlanExecutor> exec; + std::shared_ptr<PlanExecutor> exec; bool sortInRunner = false; const WhereCallbackReal whereCallback(pExpCtx->opCtx, pExpCtx->ns.db()); diff --git a/src/mongo/db/pipeline/pipeline_d.h b/src/mongo/db/pipeline/pipeline_d.h index 40c7668d75d..3a818c3ddcd 100644 --- a/src/mongo/db/pipeline/pipeline_d.h +++ b/src/mongo/db/pipeline/pipeline_d.h @@ -29,7 +29,7 @@ #pragma once #include <boost/intrusive_ptr.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> namespace mongo { class Collection; @@ -72,7 +72,7 @@ namespace mongo { * @param pPipeline the logical "this" for this operation * @param pExpCtx the expression context for this pipeline */ - static boost::shared_ptr<PlanExecutor> prepareCursorSource( + static std::shared_ptr<PlanExecutor> prepareCursorSource( OperationContext* txn, Collection* collection, const boost::intrusive_ptr<Pipeline> &pPipeline, diff --git a/src/mongo/db/pipeline/value.h b/src/mongo/db/pipeline/value.h index ecc66719d11..f388b82be7b 100644 --- a/src/mongo/db/pipeline/value.h +++ b/src/mongo/db/pipeline/value.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/pipeline/value_internal.h" #include "mongo/platform/unordered_set.h" diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp index 6e56b9b20f0..24b01bb704e 100644 --- a/src/mongo/db/query/plan_executor.cpp +++ b/src/mongo/db/query/plan_executor.cpp @@ -28,7 +28,6 @@ #include "mongo/db/query/plan_executor.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/catalog/collection.h" #include "mongo/db/concurrency/write_conflict_exception.h" @@ -49,7 +48,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; using std::vector; diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp index 8bd5ee04cce..f6fd9eea580 100644 --- a/src/mongo/db/repl/master_slave.cpp +++ b/src/mongo/db/repl/master_slave.cpp @@ -43,7 +43,6 @@ #include "mongo/db/repl/master_slave.h" #include <pcrecpp.h> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include "mongo/db/auth/authorization_manager.h" @@ -250,7 +249,7 @@ namespace repl { } } - v.push_back( boost::shared_ptr< ReplSource >( new ReplSource( s ) ) ); + v.push_back( std::shared_ptr< ReplSource >( new ReplSource( s ) ) ); } /* we reuse our existing objects so that we can keep our existing connection diff --git a/src/mongo/db/repl/master_slave.h b/src/mongo/db/repl/master_slave.h index dd74c508e33..835d5e33dab 100644 --- a/src/mongo/db/repl/master_slave.h +++ b/src/mongo/db/repl/master_slave.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/repl/oplogreader.h" @@ -77,7 +76,7 @@ namespace repl { not done (always use main for now). */ class ReplSource { - boost::shared_ptr<threadpool::ThreadPool> tp; + std::shared_ptr<threadpool::ThreadPool> tp; void resync(OperationContext* txn, const std::string& dbName); @@ -140,7 +139,7 @@ namespace repl { int nClonedThisPass; - typedef std::vector< boost::shared_ptr< ReplSource > > SourceVector; + typedef std::vector< std::shared_ptr< ReplSource > > SourceVector; static void loadAll(OperationContext* txn, SourceVector&); explicit ReplSource(OperationContext* txn, BSONObj); diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp index f0b0d98d891..d982eae975e 100644 --- a/src/mongo/db/repl/oplogreader.cpp +++ b/src/mongo/db/repl/oplogreader.cpp @@ -32,7 +32,6 @@ #include "mongo/db/repl/oplogreader.h" -#include <boost/shared_ptr.hpp> #include <string> #include "mongo/base/counter.h" @@ -53,7 +52,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::string; diff --git a/src/mongo/db/repl/oplogreader.h b/src/mongo/db/repl/oplogreader.h index 66ac8f9c6c0..63dcaaeaa20 100644 --- a/src/mongo/db/repl/oplogreader.h +++ b/src/mongo/db/repl/oplogreader.h @@ -31,7 +31,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/client/constants.h" #include "mongo/client/dbclientcursor.h" @@ -62,8 +61,8 @@ namespace repl { class OplogReader { private: - boost::shared_ptr<DBClientConnection> _conn; - boost::shared_ptr<DBClientCursor> cursor; + std::shared_ptr<DBClientConnection> _conn; + std::shared_ptr<DBClientCursor> cursor; int _tailingQueryOptions; // If _conn was actively connected, _host represents the current HostAndPort of the diff --git a/src/mongo/db/repl/replication_executor.h b/src/mongo/db/repl/replication_executor.h index 8b7dd5255c9..f3bb25c2c4f 100644 --- a/src/mongo/db/repl/replication_executor.h +++ b/src/mongo/db/repl/replication_executor.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> #include <string> @@ -572,7 +571,7 @@ namespace repl { uint64_t generation; bool isSignaled; WorkQueue waiters; - boost::shared_ptr<boost::condition_variable> isSignaledCondition; + std::shared_ptr<boost::condition_variable> isSignaledCondition; }; } // namespace repl diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index bbd53eb887c..e5f01a6c8c7 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -33,7 +33,6 @@ #include "mongo/db/repl/rs_rollback.h" -#include <boost/shared_ptr.hpp> #include <memory> #include "mongo/db/auth/authorization_manager_global.h" @@ -103,7 +102,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::endl; using std::list; diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp index adf287fa86d..17444f24d9d 100644 --- a/src/mongo/db/sorter/sorter.cpp +++ b/src/mongo/db/sorter/sorter.cpp @@ -48,8 +48,6 @@ #include "mongo/db/sorter/sorter.h" #include <boost/filesystem/operations.hpp> -#include <boost/make_shared.hpp> -#include <boost/shared_ptr.hpp> #include <snappy.h> #include "mongo/base/string_data.h" @@ -67,7 +65,7 @@ namespace mongo { namespace sorter { - using boost::shared_ptr; + using std::shared_ptr; using namespace mongoutils; // We need to use the "real" errno everywhere, not GetLastError() on Windows @@ -164,7 +162,7 @@ namespace mongo { FileIterator(const std::string& fileName, const Settings& settings, - boost::shared_ptr<FileDeleter> fileDeleter) + std::shared_ptr<FileDeleter> fileDeleter) : _settings(settings) , _done(false) , _fileName(fileName) @@ -260,7 +258,7 @@ namespace mongo { std::unique_ptr<char[]> _buffer; std::unique_ptr<BufReader> _reader; std::string _fileName; - boost::shared_ptr<FileDeleter> _fileDeleter; // Must outlive _file + std::shared_ptr<FileDeleter> _fileDeleter; // Must outlive _file std::ifstream _file; }; @@ -272,7 +270,7 @@ namespace mongo { typedef std::pair<Key, Value> Data; - MergeIterator(const std::vector<boost::shared_ptr<Input> >& iters, + MergeIterator(const std::vector<std::shared_ptr<Input> >& iters, const SortOptions& opts, const Comparator& comp) : _opts(opts) @@ -283,7 +281,7 @@ namespace mongo { for (size_t i = 0; i < iters.size(); i++) { if (iters[i]->more()) { _heap.push_back( - boost::make_shared<Stream>(i, iters[i]->next(), iters[i])); + std::make_shared<Stream>(i, iters[i]->next(), iters[i])); } } @@ -340,7 +338,7 @@ namespace mongo { private: class Stream { // Data + Iterator public: - Stream(size_t fileNum, const Data& first, boost::shared_ptr<Input> rest) + Stream(size_t fileNum, const Data& first, std::shared_ptr<Input> rest) : fileNum(fileNum) , _current(first) , _rest(rest) @@ -359,7 +357,7 @@ namespace mongo { const size_t fileNum; private: Data _current; - boost::shared_ptr<Input> _rest; + std::shared_ptr<Input> _rest; }; class STLComparator { // uses greater rather than less-than to maintain a MinHeap @@ -383,8 +381,8 @@ namespace mongo { SortOptions _opts; unsigned long long _remaining; bool _first; - boost::shared_ptr<Stream> _current; - std::vector<boost::shared_ptr<Stream> > _heap; // MinHeap + std::shared_ptr<Stream> _current; + std::vector<std::shared_ptr<Stream> > _heap; // MinHeap STLComparator _greater; // named so calls make sense }; @@ -474,7 +472,7 @@ namespace mongo { writer.addAlreadySorted(_data.front().first, _data.front().second); } - _iters.push_back(boost::shared_ptr<Iterator>(writer.done())); + _iters.push_back(std::shared_ptr<Iterator>(writer.done())); _memUsed = 0; } @@ -484,7 +482,7 @@ namespace mongo { SortOptions _opts; size_t _memUsed; std::deque<Data> _data; // the "current" data - std::vector<boost::shared_ptr<Iterator> > _iters; // data that has already been spilled + std::vector<std::shared_ptr<Iterator> > _iters; // data that has already been spilled }; template <typename Key, typename Value, typename Comparator> @@ -749,7 +747,7 @@ namespace mongo { // clear _data and release backing array's memory std::vector<Data>().swap(_data); - _iters.push_back(boost::shared_ptr<Iterator>(writer.done())); + _iters.push_back(std::shared_ptr<Iterator>(writer.done())); _memUsed = 0; } @@ -759,7 +757,7 @@ namespace mongo { SortOptions _opts; size_t _memUsed; std::vector<Data> _data; // the "current" data. Organized as max-heap if size == limit. - std::vector<boost::shared_ptr<Iterator> > _iters; // data that has already been spilled + std::vector<std::shared_ptr<Iterator> > _iters; // data that has already been spilled // See updateCutoff() for a full description of how these members are used. bool _haveCutoff; @@ -809,7 +807,7 @@ namespace mongo { << sorter::myErrnoWithDescription(), _file.good()); - _fileDeleter = boost::make_shared<sorter::FileDeleter>(_fileName); + _fileDeleter = std::make_shared<sorter::FileDeleter>(_fileName); // throw on failure _file.exceptions(std::ios::failbit | std::ios::badbit | std::ios::eofbit); @@ -867,7 +865,7 @@ namespace mongo { template <typename Key, typename Value> template <typename Comparator> SortIteratorInterface<Key, Value>* SortIteratorInterface<Key, Value>::merge( - const std::vector<boost::shared_ptr<SortIteratorInterface> >& iters, + const std::vector<std::shared_ptr<SortIteratorInterface> >& iters, const SortOptions& opts, const Comparator& comp) { return new sorter::MergeIterator<Key, Value, Comparator>(iters, opts, comp); diff --git a/src/mongo/db/sorter/sorter.h b/src/mongo/db/sorter/sorter.h index 49840ddd94d..d8a117d83ee 100644 --- a/src/mongo/db/sorter/sorter.h +++ b/src/mongo/db/sorter/sorter.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <deque> #include <fstream> #include <string> @@ -145,7 +144,7 @@ namespace mongo { /// Returns an iterator that merges the passed in iterators template <typename Comparator> static SortIteratorInterface* merge( - const std::vector<boost::shared_ptr<SortIteratorInterface> >& iters, + const std::vector<std::shared_ptr<SortIteratorInterface> >& iters, const SortOptions& opts, const Comparator& comp); protected: @@ -202,7 +201,7 @@ namespace mongo { const Settings _settings; std::string _fileName; - boost::shared_ptr<sorter::FileDeleter> _fileDeleter; // Must outlive _file + std::shared_ptr<sorter::FileDeleter> _fileDeleter; // Must outlive _file std::ofstream _file; BufBuilder _buffer; }; @@ -227,7 +226,7 @@ namespace mongo { /* factory functions */ \ template ::mongo::SortIteratorInterface<Key, Value>* \ ::mongo::SortIteratorInterface<Key, Value>::merge<Comparator>( \ - const std::vector<boost::shared_ptr<SortIteratorInterface> >& iters, \ + const std::vector<std::shared_ptr<SortIteratorInterface> >& iters, \ const SortOptions& opts, \ const Comparator& comp); \ template ::mongo::Sorter<Key, Value>* \ diff --git a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp index f053c5de4a7..91f4f7c698d 100644 --- a/src/mongo/db/sorter/sorter_test.cpp +++ b/src/mongo/db/sorter/sorter_test.cpp @@ -31,8 +31,6 @@ #include "mongo/db/sorter/sorter.h" #include <boost/filesystem.hpp> -#include <boost/make_shared.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include "mongo/config.h" @@ -45,7 +43,7 @@ namespace mongo { using namespace mongo::sorter; - using boost::make_shared; + using std::make_shared; using std::pair; // Stub to avoid including the server_options library @@ -124,7 +122,7 @@ namespace mongo { class LimitIterator : public IWIterator { public: - LimitIterator(long long limit, boost::shared_ptr<IWIterator> source) + LimitIterator(long long limit, std::shared_ptr<IWIterator> source) : _remaining(limit) , _source(source) { verify(limit > 0); } @@ -138,7 +136,7 @@ namespace mongo { private: long long _remaining; - boost::shared_ptr<IWIterator> _source; + std::shared_ptr<IWIterator> _source; }; template <typename It1, typename It2> @@ -166,21 +164,21 @@ namespace mongo { #define ASSERT_ITERATORS_EQUIVALENT(it1, it2) _assertIteratorsEquivalent(it1, it2, __LINE__) template <int N> - boost::shared_ptr<IWIterator> makeInMemIterator(const int (&array)[N]) { + std::shared_ptr<IWIterator> makeInMemIterator(const int (&array)[N]) { std::vector<IWPair> vec; for (int i=0; i<N; i++) vec.push_back(IWPair(array[i], -array[i])); - return boost::make_shared<sorter::InMemIterator<IntWrapper, IntWrapper> >(vec); + return std::make_shared<sorter::InMemIterator<IntWrapper, IntWrapper> >(vec); } template <typename IteratorPtr, int N> - boost::shared_ptr<IWIterator> mergeIterators(IteratorPtr (&array)[N], + std::shared_ptr<IWIterator> mergeIterators(IteratorPtr (&array)[N], Direction Dir=ASC, const SortOptions& opts=SortOptions()) { - std::vector<boost::shared_ptr<IWIterator> > vec; + std::vector<std::shared_ptr<IWIterator> > vec; for (int i=0; i<N; i++) - vec.push_back(boost::shared_ptr<IWIterator>(array[i])); - return boost::shared_ptr<IWIterator>(IWIterator::merge(vec, opts, IWComparator(Dir))); + vec.push_back(std::shared_ptr<IWIterator>(array[i])); + return std::shared_ptr<IWIterator>(IWIterator::merge(vec, opts, IWComparator(Dir))); } // @@ -233,7 +231,7 @@ namespace mongo { sorter.addAlreadySorted(2,-2); sorter.addAlreadySorted(3,-3); sorter.addAlreadySorted(4,-4); - ASSERT_ITERATORS_EQUIVALENT(boost::shared_ptr<IWIterator>(sorter.done()), + ASSERT_ITERATORS_EQUIVALENT(std::shared_ptr<IWIterator>(sorter.done()), make_shared<IntIterator>(0,5)); } { // big @@ -241,7 +239,7 @@ namespace mongo { for (int i=0; i< 10*1000*1000; i++) sorter.addAlreadySorted(i,-i); - ASSERT_ITERATORS_EQUIVALENT(boost::shared_ptr<IWIterator>(sorter.done()), + ASSERT_ITERATORS_EQUIVALENT(std::shared_ptr<IWIterator>(sorter.done()), make_shared<IntIterator>(0,10*1000*1000)); } @@ -255,15 +253,15 @@ namespace mongo { public: void run() { { // test empty (no inputs) - std::vector<boost::shared_ptr<IWIterator> > vec; - boost::shared_ptr<IWIterator> mergeIter (IWIterator::merge(vec, + std::vector<std::shared_ptr<IWIterator> > vec; + std::shared_ptr<IWIterator> mergeIter (IWIterator::merge(vec, SortOptions(), IWComparator())); ASSERT_ITERATORS_EQUIVALENT(mergeIter, make_shared<EmptyIterator>()); } { // test empty (only empty inputs) - boost::shared_ptr<IWIterator> iterators[] = + std::shared_ptr<IWIterator> iterators[] = { make_shared<EmptyIterator>() , make_shared<EmptyIterator>() , make_shared<EmptyIterator>() @@ -274,7 +272,7 @@ namespace mongo { } { // test ASC - boost::shared_ptr<IWIterator> iterators[] = + std::shared_ptr<IWIterator> iterators[] = { make_shared<IntIterator>(1, 20, 2) // 1, 3, ... 19 , make_shared<IntIterator>(0, 20, 2) // 0, 2, ... 18 }; @@ -284,7 +282,7 @@ namespace mongo { } { // test DESC with an empty source - boost::shared_ptr<IWIterator> iterators[] = + std::shared_ptr<IWIterator> iterators[] = { make_shared<IntIterator>(30, 0, -3) // 30, 27, ... 3 , make_shared<IntIterator>(29, 0, -3) // 29, 26, ... 2 , make_shared<IntIterator>(28, 0, -3) // 28, 25, ... 1 @@ -295,7 +293,7 @@ namespace mongo { make_shared<IntIterator>(30,0,-1)); } { // test Limit - boost::shared_ptr<IWIterator> iterators[] = + std::shared_ptr<IWIterator> iterators[] = { make_shared<IntIterator>(1, 20, 2) // 1, 3, ... 19 , make_shared<IntIterator>(0, 20, 2) // 0, 2, ... 18 }; @@ -330,12 +328,12 @@ namespace mongo { } { // test all data ASC - boost::shared_ptr<IWSorter> sorter = makeSorter(opts, IWComparator(ASC)); + std::shared_ptr<IWSorter> sorter = makeSorter(opts, IWComparator(ASC)); addData(sorter); ASSERT_ITERATORS_EQUIVALENT(done(sorter), correct()); } { // test all data DESC - boost::shared_ptr<IWSorter> sorter = makeSorter(opts, IWComparator(DESC)); + std::shared_ptr<IWSorter> sorter = makeSorter(opts, IWComparator(DESC)); addData(sorter); ASSERT_ITERATORS_EQUIVALENT(done(sorter), correctReverse()); } @@ -344,7 +342,7 @@ namespace mongo { // Among other things, MSVC++ makes all heap functions O(N) not O(logN). #if !defined(MONGO_CONFIG_DEBUG_BUILD) { // merge all data ASC - boost::shared_ptr<IWSorter> sorters[] = { + std::shared_ptr<IWSorter> sorters[] = { makeSorter(opts, IWComparator(ASC)), makeSorter(opts, IWComparator(ASC)) }; @@ -352,13 +350,13 @@ namespace mongo { addData(sorters[0]); addData(sorters[1]); - boost::shared_ptr<IWIterator> iters1[] = {done(sorters[0]), done(sorters[1])}; - boost::shared_ptr<IWIterator> iters2[] = {correct(), correct()}; + std::shared_ptr<IWIterator> iters1[] = {done(sorters[0]), done(sorters[1])}; + std::shared_ptr<IWIterator> iters2[] = {correct(), correct()}; ASSERT_ITERATORS_EQUIVALENT(mergeIterators(iters1, ASC), mergeIterators(iters2, ASC)); } { // merge all data DESC and use multiple threads to insert - boost::shared_ptr<IWSorter> sorters[] = { + std::shared_ptr<IWSorter> sorters[] = { makeSorter(opts, IWComparator(DESC)), makeSorter(opts, IWComparator(DESC)) }; @@ -367,8 +365,8 @@ namespace mongo { addData(sorters[1]); inBackground.join(); - boost::shared_ptr<IWIterator> iters1[] = {done(sorters[0]), done(sorters[1])}; - boost::shared_ptr<IWIterator> iters2[] = {correctReverse(), correctReverse()}; + std::shared_ptr<IWIterator> iters1[] = {done(sorters[0]), done(sorters[1])}; + std::shared_ptr<IWIterator> iters2[] = {correctReverse(), correctReverse()}; ASSERT_ITERATORS_EQUIVALENT(mergeIterators(iters1, DESC), mergeIterators(iters2, DESC)); } @@ -386,12 +384,12 @@ namespace mongo { } // returns an iterator with the correct results - virtual boost::shared_ptr<IWIterator> correct() { + virtual std::shared_ptr<IWIterator> correct() { return make_shared<IntIterator>(0,5); // 0, 1, ... 4 } // like correct but with opposite sort direction - virtual boost::shared_ptr<IWIterator> correctReverse() { + virtual std::shared_ptr<IWIterator> correctReverse() { return make_shared<IntIterator>(4,-1,-1); // 4, 3, ... 0 } @@ -403,13 +401,13 @@ namespace mongo { private: // Make a new sorter with desired opts and comp. Opts may be ignored but not comp - boost::shared_ptr<IWSorter> makeSorter(SortOptions opts, + std::shared_ptr<IWSorter> makeSorter(SortOptions opts, IWComparator comp=IWComparator(ASC)) { - return boost::shared_ptr<IWSorter>(IWSorter::make(adjustSortOptions(opts), comp)); + return std::shared_ptr<IWSorter>(IWSorter::make(adjustSortOptions(opts), comp)); } - boost::shared_ptr<IWIterator> done(unowned_ptr<IWSorter> sorter) { - return boost::shared_ptr<IWIterator>(sorter->done()); + std::shared_ptr<IWIterator> done(unowned_ptr<IWSorter> sorter) { + return std::shared_ptr<IWIterator>(sorter->done()); } }; @@ -425,10 +423,10 @@ namespace mongo { sorter->add(1,-1); sorter->add(-1,1); } - virtual boost::shared_ptr<IWIterator> correct() { + virtual std::shared_ptr<IWIterator> correct() { return make_shared<IntIterator>(-1,4); } - virtual boost::shared_ptr<IWIterator> correctReverse() { + virtual std::shared_ptr<IWIterator> correctReverse() { return make_shared<IntIterator>(4,-1,-1); } }; @@ -446,11 +444,11 @@ namespace mongo { sorter->add(2,-2); sorter->add(3,-3); } - virtual boost::shared_ptr<IWIterator> correct() { + virtual std::shared_ptr<IWIterator> correct() { const int array[] = {-1,-1,-1, 0, 1,1,1, 2,2, 3}; return makeInMemIterator(array); } - virtual boost::shared_ptr<IWIterator> correctReverse() { + virtual std::shared_ptr<IWIterator> correctReverse() { const int array[] = {3, 2,2, 1,1,1, 0, -1,-1,-1}; return makeInMemIterator(array); } @@ -486,10 +484,10 @@ namespace mongo { } } - virtual boost::shared_ptr<IWIterator> correct() { + virtual std::shared_ptr<IWIterator> correct() { return make_shared<IntIterator>(0, NUM_ITEMS); } - virtual boost::shared_ptr<IWIterator> correctReverse() { + virtual std::shared_ptr<IWIterator> correctReverse() { return make_shared<IntIterator>(NUM_ITEMS-1, -1, -1); } @@ -516,10 +514,10 @@ namespace mongo { return opts.MaxMemoryUsageBytes(MEM_LIMIT).ExtSortAllowed().Limit(Limit); } - virtual boost::shared_ptr<IWIterator> correct() { + virtual std::shared_ptr<IWIterator> correct() { return make_shared<LimitIterator>(Limit, Parent::correct()); } - virtual boost::shared_ptr<IWIterator> correctReverse() { + virtual std::shared_ptr<IWIterator> correctReverse() { return make_shared<LimitIterator>(Limit, Parent::correctReverse()); } enum { MEM_LIMIT = 32*1024 }; diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h index 126544b6108..b6d14c52399 100644 --- a/src/mongo/db/storage/devnull/devnull_kv_engine.h +++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h @@ -30,7 +30,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/storage/kv/kv_engine.h" #include "mongo/db/storage/recovery_unit_noop.h" @@ -105,6 +104,6 @@ namespace mongo { virtual void cleanShutdown() {}; private: - boost::shared_ptr<void> _catalogInfo; + std::shared_ptr<void> _catalogInfo; }; } diff --git a/src/mongo/db/storage/in_memory/in_memory_btree_impl.cpp b/src/mongo/db/storage/in_memory/in_memory_btree_impl.cpp index 1b937118bb3..40da9035fbd 100644 --- a/src/mongo/db/storage/in_memory/in_memory_btree_impl.cpp +++ b/src/mongo/db/storage/in_memory/in_memory_btree_impl.cpp @@ -32,8 +32,6 @@ #include "mongo/db/storage/in_memory/in_memory_btree_impl.h" -#include <boost/make_shared.hpp> -#include <boost/shared_ptr.hpp> #include <set> #include "mongo/db/catalog/index_catalog_entry.h" @@ -44,7 +42,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; using std::vector; @@ -480,10 +478,10 @@ namespace { // IndexCatalogEntry argument taken by non-const pointer for consistency with other Btree // factories. We don't actually modify it. SortedDataInterface* getInMemoryBtreeImpl(const Ordering& ordering, - boost::shared_ptr<void>* dataInOut) { + std::shared_ptr<void>* dataInOut) { invariant(dataInOut); if (!*dataInOut) { - *dataInOut = boost::make_shared<IndexSet>(IndexEntryComparison(ordering)); + *dataInOut = std::make_shared<IndexSet>(IndexEntryComparison(ordering)); } return new InMemoryBtreeImpl(static_cast<IndexSet*>(dataInOut->get())); } diff --git a/src/mongo/db/storage/in_memory/in_memory_btree_impl.h b/src/mongo/db/storage/in_memory/in_memory_btree_impl.h index 3297b599b1e..ee318312c78 100644 --- a/src/mongo/db/storage/in_memory/in_memory_btree_impl.h +++ b/src/mongo/db/storage/in_memory/in_memory_btree_impl.h @@ -28,7 +28,6 @@ * it in the license file. */ -#include <boost/shared_ptr.hpp> #include "mongo/db/storage/sorted_data_interface.h" @@ -43,6 +42,6 @@ namespace mongo { * All permanent data will be stored and fetch from dataInOut. */ SortedDataInterface* getInMemoryBtreeImpl(const Ordering& ordering, - boost::shared_ptr<void>* dataInOut); + std::shared_ptr<void>* dataInOut); } // namespace mongo diff --git a/src/mongo/db/storage/in_memory/in_memory_btree_impl_test.cpp b/src/mongo/db/storage/in_memory/in_memory_btree_impl_test.cpp index 560b2bb3e0b..867a093b3e0 100644 --- a/src/mongo/db/storage/in_memory/in_memory_btree_impl_test.cpp +++ b/src/mongo/db/storage/in_memory/in_memory_btree_impl_test.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/in_memory/in_memory_btree_impl.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/storage/in_memory/in_memory_recovery_unit.h" #include "mongo/db/storage/sorted_data_interface_test_harness.h" @@ -54,7 +53,7 @@ namespace mongo { } private: - boost::shared_ptr<void> _data; // used by InMemoryBtreeImpl + std::shared_ptr<void> _data; // used by InMemoryBtreeImpl Ordering _order; }; diff --git a/src/mongo/db/storage/in_memory/in_memory_engine.h b/src/mongo/db/storage/in_memory/in_memory_engine.h index 65e180da458..687104254d3 100644 --- a/src/mongo/db/storage/in_memory/in_memory_engine.h +++ b/src/mongo/db/storage/in_memory/in_memory_engine.h @@ -30,7 +30,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include "mongo/db/storage/kv/kv_engine.h" @@ -88,7 +87,7 @@ namespace mongo { std::vector<std::string> getAllIdents( OperationContext* opCtx ) const; private: - typedef StringMap<boost::shared_ptr<void> > DataMap; + typedef StringMap<std::shared_ptr<void> > DataMap; mutable boost::mutex _mutex; DataMap _dataMap; // All actual data is owned in here diff --git a/src/mongo/db/storage/in_memory/in_memory_record_store.cpp b/src/mongo/db/storage/in_memory/in_memory_record_store.cpp index 92deaf82810..b0c583954f6 100644 --- a/src/mongo/db/storage/in_memory/in_memory_record_store.cpp +++ b/src/mongo/db/storage/in_memory/in_memory_record_store.cpp @@ -33,7 +33,6 @@ #include "mongo/db/storage/in_memory/in_memory_record_store.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" @@ -47,7 +46,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; class InMemoryRecordStore::InsertChange : public RecoveryUnit::Change { public: @@ -262,7 +261,7 @@ namespace mongo { // InMemoryRecordStore::InMemoryRecordStore(StringData ns, - boost::shared_ptr<void>* dataInOut, + std::shared_ptr<void>* dataInOut, bool isCapped, int64_t cappedMaxSize, int64_t cappedMaxDocs, diff --git a/src/mongo/db/storage/in_memory/in_memory_record_store.h b/src/mongo/db/storage/in_memory/in_memory_record_store.h index e091d75c4a1..53df7883758 100644 --- a/src/mongo/db/storage/in_memory/in_memory_record_store.h +++ b/src/mongo/db/storage/in_memory/in_memory_record_store.h @@ -31,7 +31,6 @@ #pragma once #include <boost/shared_array.hpp> -#include <boost/shared_ptr.hpp> #include <map> #include "mongo/db/storage/capped_callback.h" @@ -47,7 +46,7 @@ namespace mongo { class InMemoryRecordStore : public RecordStore { public: explicit InMemoryRecordStore(StringData ns, - boost::shared_ptr<void>* dataInOut, + std::shared_ptr<void>* dataInOut, bool isCapped = false, int64_t cappedMaxSize = -1, int64_t cappedMaxDocs = -1, diff --git a/src/mongo/db/storage/in_memory/in_memory_record_store_test.cpp b/src/mongo/db/storage/in_memory/in_memory_record_store_test.cpp index 258317c8976..42138116da9 100644 --- a/src/mongo/db/storage/in_memory/in_memory_record_store_test.cpp +++ b/src/mongo/db/storage/in_memory/in_memory_record_store_test.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/in_memory/in_memory_record_store.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/storage/in_memory/in_memory_recovery_unit.h" #include "mongo/db/storage/record_store_test_harness.h" @@ -51,7 +50,7 @@ namespace mongo { return new InMemoryRecoveryUnit(); } - boost::shared_ptr<void> data; + std::shared_ptr<void> data; }; HarnessHelper* newHarnessHelper() { diff --git a/src/mongo/db/storage/in_memory/in_memory_recovery_unit.h b/src/mongo/db/storage/in_memory/in_memory_recovery_unit.h index 343e9abf595..2ef0552d58e 100644 --- a/src/mongo/db/storage/in_memory/in_memory_recovery_unit.h +++ b/src/mongo/db/storage/in_memory/in_memory_recovery_unit.h @@ -30,7 +30,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <vector> #include "mongo/db/record_id.h" @@ -65,7 +64,7 @@ namespace mongo { virtual SnapshotId getSnapshotId() const { return SnapshotId(); } private: - typedef boost::shared_ptr<Change> ChangePtr; + typedef std::shared_ptr<Change> ChangePtr; typedef std::vector<ChangePtr> Changes; Changes _changes; diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp index 94096dc910e..4b33d7a2bf9 100644 --- a/src/mongo/db/storage/mmap_v1/dur.cpp +++ b/src/mongo/db/storage/mmap_v1/dur.cpp @@ -75,7 +75,6 @@ #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <iomanip> #include <utility> @@ -527,7 +526,7 @@ namespace { } void DurableImpl::createdFile(const std::string& filename, unsigned long long len) { - boost::shared_ptr<DurOp> op(new FileCreatedOp(filename, len)); + std::shared_ptr<DurOp> op(new FileCreatedOp(filename, len)); commitJob.noteOp(op); } diff --git a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp index bfcdd30de4b..666a6c4a2eb 100644 --- a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp @@ -44,7 +44,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::max; using std::min; diff --git a/src/mongo/db/storage/mmap_v1/dur_commitjob.h b/src/mongo/db/storage/mmap_v1/dur_commitjob.h index a7fae340989..b2d07c3b293 100644 --- a/src/mongo/db/storage/mmap_v1/dur_commitjob.h +++ b/src/mongo/db/storage/mmap_v1/dur_commitjob.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/storage/mmap_v1/durop.h" #include "mongo/util/concurrency/mutex.h" @@ -36,7 +35,7 @@ namespace mongo { namespace dur { - typedef std::vector<boost::shared_ptr<DurOp> > DurOpsVector; + typedef std::vector<std::shared_ptr<DurOp> > DurOpsVector; /** * Declaration of an intent to write to a region of a memory mapped view. We store the end @@ -141,7 +140,7 @@ namespace dur { /** * Note an operation other than a "basic write". */ - void noteOp(boost::shared_ptr<DurOp> p); + void noteOp(std::shared_ptr<DurOp> p); /** * Record/note an intent to write. diff --git a/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp b/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp index 73583a77ef7..b79dba66cfd 100644 --- a/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp @@ -38,7 +38,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include "mongo/db/storage/mmap_v1/aligned_builder.h" @@ -181,8 +180,8 @@ namespace mongo { h.fileId = j.curFileId(); // Ops other than basic writes (DurOp's) go first - const std::vector<boost::shared_ptr<DurOp> >& durOps = commitJob.ops(); - for (std::vector<boost::shared_ptr<DurOp> >::const_iterator i = durOps.begin(); + const std::vector<std::shared_ptr<DurOp> >& durOps = commitJob.ops(); + for (std::vector<std::shared_ptr<DurOp> >::const_iterator i = durOps.begin(); i != durOps.end(); i++) { diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.cpp b/src/mongo/db/storage/mmap_v1/dur_recover.cpp index 5e61e39930f..edef79fc92b 100644 --- a/src/mongo/db/storage/mmap_v1/dur_recover.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_recover.cpp @@ -58,7 +58,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::endl; using std::hex; @@ -99,7 +99,7 @@ namespace mongo { const JEntry *e; // local db sentinel is already parsed out here into dbName // if not one of the two simple JEntry's above, this is the operation: - boost::shared_ptr<DurOp> op; + std::shared_ptr<DurOp> op; }; @@ -190,7 +190,7 @@ namespace mongo { case JEntry::OpCode_FileCreated: case JEntry::OpCode_DropDb: { e.dbName = 0; - boost::shared_ptr<DurOp> op = DurOp::read(lenOrOpCode, *_entries); + std::shared_ptr<DurOp> op = DurOp::read(lenOrOpCode, *_entries); if (_doDurOps) { e.op = op; } @@ -302,7 +302,7 @@ namespace mongo { log() << "journal error applying writes, file " << fn << " is not open" << endl; verify(false); } - boost::shared_ptr<DurableMappedFile> sp (new DurableMappedFile); + std::shared_ptr<DurableMappedFile> sp (new DurableMappedFile); verify(sp->open(fn, false)); rj._mmfs.push_back(sp); mmf = sp.get(); diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.h b/src/mongo/db/storage/mmap_v1/dur_recover.h index a78c05eb242..1e22a693ed6 100644 --- a/src/mongo/db/storage/mmap_v1/dur_recover.h +++ b/src/mongo/db/storage/mmap_v1/dur_recover.h @@ -31,7 +31,6 @@ #pragma once #include <boost/filesystem/operations.hpp> -#include <boost/shared_ptr.hpp> #include <list> #include "mongo/db/storage/mmap_v1/dur_journalformat.h" @@ -87,7 +86,7 @@ namespace mongo { // Set of memory mapped files and a mutex to protect them mongo::mutex _mx; - std::list<boost::shared_ptr<DurableMappedFile> > _mmfs; + std::list<std::shared_ptr<DurableMappedFile> > _mmfs; // Are we in recovery or WRITETODATAFILES bool _recovering; diff --git a/src/mongo/db/storage/mmap_v1/durop.cpp b/src/mongo/db/storage/mmap_v1/durop.cpp index 573c1f5688a..2a049596593 100644 --- a/src/mongo/db/storage/mmap_v1/durop.cpp +++ b/src/mongo/db/storage/mmap_v1/durop.cpp @@ -35,7 +35,6 @@ #include "mongo/db/storage/mmap_v1/durop.h" #include <boost/filesystem/operations.hpp> -#include <boost/shared_ptr.hpp> #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/storage/mmap_v1/aligned_builder.h" @@ -49,7 +48,7 @@ namespace mongo { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::string; diff --git a/src/mongo/db/storage/mmap_v1/durop.h b/src/mongo/db/storage/mmap_v1/durop.h index e7da38a32d1..9ebddb3dfc0 100644 --- a/src/mongo/db/storage/mmap_v1/durop.h +++ b/src/mongo/db/storage/mmap_v1/durop.h @@ -30,7 +30,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/storage/mmap_v1/dur_journalformat.h" #include "mongo/db/storage/paths.h" @@ -64,7 +63,7 @@ namespace mongo { /** read a durop from journal file referenced by br. @param opcode the opcode which has already been written from the bufreader */ - static boost::shared_ptr<DurOp> read(unsigned opcode, BufReader& br); + static std::shared_ptr<DurOp> read(unsigned opcode, BufReader& br); /** replay the operation (during recovery) throws diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h index 4d3c50c09f7..c2b3d42538f 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <wiredtiger.h> #include "mongo/base/status_with.h" diff --git a/src/mongo/dbtests/basictests.cpp b/src/mongo/dbtests/basictests.cpp index 907389d3403..cfafc97fc0f 100644 --- a/src/mongo/dbtests/basictests.cpp +++ b/src/mongo/dbtests/basictests.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <iostream> #include "mongo/db/operation_context_impl.h" @@ -48,7 +47,7 @@ namespace BasicTests { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::cout; using std::dec; using std::endl; diff --git a/src/mongo/dbtests/chunktests.cpp b/src/mongo/dbtests/chunktests.cpp index 90bd6480903..aa86f53ebec 100644 --- a/src/mongo/dbtests/chunktests.cpp +++ b/src/mongo/dbtests/chunktests.cpp @@ -59,7 +59,7 @@ namespace mongo { Shard shard(shardId, ConnectionString(HostAndPort(shardId))); Shard::installShard(shardId, shard); - boost::shared_ptr<Chunk> chunk(new Chunk(this, + std::shared_ptr<Chunk> chunk(new Chunk(this, mySplitPoints[i - 1], mySplitPoints[i], shardId)); diff --git a/src/mongo/dbtests/dbtests.h b/src/mongo/dbtests/dbtests.h index a3996b2e37a..d6c1e089bb2 100644 --- a/src/mongo/dbtests/dbtests.h +++ b/src/mongo/dbtests/dbtests.h @@ -31,14 +31,13 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/instance.h" #include "mongo/unittest/unittest.h" using namespace mongo; using namespace mongo::unittest; -using boost::shared_ptr; +using std::shared_ptr; namespace mongo { class BSONObj; diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp index 8785cb312cb..07e4d2f840b 100644 --- a/src/mongo/dbtests/documentsourcetests.cpp +++ b/src/mongo/dbtests/documentsourcetests.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/condition.hpp> @@ -49,7 +48,7 @@ namespace DocumentSourceTests { using boost::intrusive_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::map; using std::set; using std::string; @@ -204,7 +203,7 @@ namespace DocumentSourceTests { private: // It is important that these are ordered to ensure correct destruction order. - boost::shared_ptr<PlanExecutor> _exec; + std::shared_ptr<PlanExecutor> _exec; intrusive_ptr<ExpressionContext> _ctx; intrusive_ptr<DocumentSourceCursor> _source; }; diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h index 38016a0eb8e..8bd045f0dd4 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.h +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h @@ -27,7 +27,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include <vector> diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.h b/src/mongo/dbtests/mock/mock_remote_db_server.h index aded4542d31..f037163b2d0 100644 --- a/src/mongo/dbtests/mock/mock_remote_db_server.h +++ b/src/mongo/dbtests/mock/mock_remote_db_server.h @@ -27,7 +27,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include <vector> @@ -210,7 +209,7 @@ namespace mongo { */ void checkIfUp(InstanceID id) const; - typedef unordered_map<std::string, boost::shared_ptr<CircularBSONIterator> > CmdToReplyObj; + typedef unordered_map<std::string, std::shared_ptr<CircularBSONIterator> > CmdToReplyObj; typedef unordered_map<std::string, std::vector<BSONObj> > MockDataMgr; bool _isRunning; diff --git a/src/mongo/dbtests/perftests.cpp b/src/mongo/dbtests/perftests.cpp index 20041d7b2c2..012f8bfab94 100644 --- a/src/mongo/dbtests/perftests.cpp +++ b/src/mongo/dbtests/perftests.cpp @@ -39,7 +39,6 @@ #include "mongo/platform/basic.h" #include <boost/filesystem/operations.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/condition.hpp> #include <boost/version.hpp> @@ -73,7 +72,7 @@ namespace PerfTests { - using boost::shared_ptr; + using std::shared_ptr; using std::cout; using std::endl; using std::fixed; @@ -120,7 +119,7 @@ namespace PerfTests { in ./../settings.py: pstatspassword="<pwd>" */ - static boost::shared_ptr<DBClientConnection> conn; + static std::shared_ptr<DBClientConnection> conn; static string _perfhostname; void pstatsConnect() { // no writing to perf db if this is a debug build @@ -154,7 +153,7 @@ namespace PerfTests { } } - boost::shared_ptr<DBClientConnection> c(new DBClientConnection(false, 60)); + std::shared_ptr<DBClientConnection> c(new DBClientConnection(false, 60)); string err; if( c->connect(HostAndPort("perfdb.10gen.cc"), err) ) { if( !c->auth("perf", "perf", pwd, err) ) { diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp index 137ee3b9984..e285e3919cb 100644 --- a/src/mongo/dbtests/query_plan_executor.cpp +++ b/src/mongo/dbtests/query_plan_executor.cpp @@ -26,7 +26,6 @@ * then also delete it in the license file. */ -#include <boost/shared_ptr.hpp> #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -51,7 +50,7 @@ namespace QueryPlanExecutor { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::string; @@ -269,7 +268,7 @@ namespace QueryPlanExecutor { addIndex(indexSpec); // Create the PlanExecutor which feeds the aggregation pipeline. - boost::shared_ptr<PlanExecutor> innerExec( + std::shared_ptr<PlanExecutor> innerExec( makeIndexScanExec(ctx.db(), indexSpec, 7, 10)); // Create the aggregation pipeline. diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp index 5b421b5807a..0f70fa6aa5b 100644 --- a/src/mongo/dbtests/query_stage_and.cpp +++ b/src/mongo/dbtests/query_stage_and.cpp @@ -31,7 +31,6 @@ * so we cannot test it outside of a dbtest. */ -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclientcursor.h" #include "mongo/db/catalog/collection.h" @@ -54,7 +53,7 @@ namespace QueryStageAnd { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::set; diff --git a/src/mongo/dbtests/query_stage_count_scan.cpp b/src/mongo/dbtests/query_stage_count_scan.cpp index 523bde78664..7c20f44b605 100644 --- a/src/mongo/dbtests/query_stage_count_scan.cpp +++ b/src/mongo/dbtests/query_stage_count_scan.cpp @@ -26,7 +26,6 @@ * then also delete it in the license file. */ -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclientcursor.h" #include "mongo/db/catalog/collection.h" @@ -47,7 +46,7 @@ namespace QueryStageCountScan { - using boost::shared_ptr; + using std::shared_ptr; class CountBase { public: diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp index d03a619a9b2..407c6f5bb89 100644 --- a/src/mongo/dbtests/query_stage_fetch.cpp +++ b/src/mongo/dbtests/query_stage_fetch.cpp @@ -30,7 +30,6 @@ * This file tests db/exec/fetch.cpp. Fetch goes to disk so we cannot test outside of a dbtest. */ -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclientcursor.h" #include "mongo/db/catalog/collection.h" @@ -47,7 +46,7 @@ namespace QueryStageFetch { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::set; diff --git a/src/mongo/dbtests/query_stage_keep.cpp b/src/mongo/dbtests/query_stage_keep.cpp index 00de94c770d..3d5b7d649c4 100644 --- a/src/mongo/dbtests/query_stage_keep.cpp +++ b/src/mongo/dbtests/query_stage_keep.cpp @@ -30,7 +30,6 @@ * This file tests db/exec/keep_mutations.cpp. */ -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclientcursor.h" #include "mongo/db/catalog/collection.h" @@ -52,7 +51,7 @@ namespace QueryStageKeep { - using boost::shared_ptr; + using std::shared_ptr; using std::set; class QueryStageKeepBase { diff --git a/src/mongo/dbtests/query_stage_near.cpp b/src/mongo/dbtests/query_stage_near.cpp index 2f2d8316fea..2ce80d94a7b 100644 --- a/src/mongo/dbtests/query_stage_near.cpp +++ b/src/mongo/dbtests/query_stage_near.cpp @@ -30,7 +30,6 @@ * This file tests near search functionality. */ -#include <boost/shared_ptr.hpp> #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/exec/near.h" @@ -40,7 +39,7 @@ namespace { using namespace mongo; - using boost::shared_ptr; + using std::shared_ptr; using std::vector; /** diff --git a/src/mongo/dbtests/sharding.cpp b/src/mongo/dbtests/sharding.cpp index 9bc6068c9fb..70413b3ad34 100644 --- a/src/mongo/dbtests/sharding.cpp +++ b/src/mongo/dbtests/sharding.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/client/parallel.h" #include "mongo/db/dbdirectclient.h" @@ -47,7 +46,7 @@ namespace ShardingTests { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::make_pair; using std::map; @@ -478,7 +477,7 @@ namespace ShardingTests { VersionMap maxShardVersions; // Create a differ which will track our progress - boost::shared_ptr< DefaultDiffAdapter > differ( _inverse ? new InverseDiffAdapter() : new DefaultDiffAdapter() ); + std::shared_ptr< DefaultDiffAdapter > differ( _inverse ? new InverseDiffAdapter() : new DefaultDiffAdapter() ); differ->attach( "test", ranges, maxVersion, maxShardVersions ); std::vector<ChunkType> chunksVector; diff --git a/src/mongo/executor/network_interface_impl.cpp b/src/mongo/executor/network_interface_impl.cpp index 129c082cd32..b204fc792de 100644 --- a/src/mongo/executor/network_interface_impl.cpp +++ b/src/mongo/executor/network_interface_impl.cpp @@ -32,7 +32,6 @@ #include "mongo/executor/network_interface_impl.h" -#include <boost/make_shared.hpp> #include <memory> #include "mongo/client/connection_pool.h" @@ -95,7 +94,7 @@ namespace { const std::string threadName(str::stream() << "ReplExecNetThread-" << _nextThreadId++); try { _threads.push_back( - boost::make_shared<boost::thread>( + std::make_shared<boost::thread>( stdx::bind(&NetworkInterfaceImpl::_requestProcessorThreadBody, this, threadName))); diff --git a/src/mongo/executor/network_interface_impl.h b/src/mongo/executor/network_interface_impl.h index c53dd3647dd..1eb653e149c 100644 --- a/src/mongo/executor/network_interface_impl.h +++ b/src/mongo/executor/network_interface_impl.h @@ -29,7 +29,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> @@ -96,7 +95,7 @@ namespace executor { RemoteCommandCompletionFn onFinish; }; typedef stdx::list<CommandData> CommandDataList; - typedef std::vector<boost::shared_ptr<boost::thread> > ThreadList; + typedef std::vector<std::shared_ptr<boost::thread> > ThreadList; /** * Thread body for threads that synchronously perform network requests from diff --git a/src/mongo/s/balance.cpp b/src/mongo/s/balance.cpp index 5275fe25c98..14d8d14381a 100644 --- a/src/mongo/s/balance.cpp +++ b/src/mongo/s/balance.cpp @@ -65,7 +65,7 @@ namespace mongo { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::map; using std::set; diff --git a/src/mongo/s/balance.h b/src/mongo/s/balance.h index 596ad5ea239..1b7bd55aa29 100644 --- a/src/mongo/s/balance.h +++ b/src/mongo/s/balance.h @@ -30,7 +30,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/util/background.h" @@ -90,7 +89,7 @@ namespace mongo { * @param conn is the connection with the config server(s) * @param candidateChunks (IN/OUT) filled with candidate chunks, one per collection, that could possibly be moved */ - void _doBalanceRound(std::vector<boost::shared_ptr<MigrateInfo>>* candidateChunks); + void _doBalanceRound(std::vector<std::shared_ptr<MigrateInfo>>* candidateChunks); /** * Issues chunk migration request, one at a time. @@ -100,7 +99,7 @@ namespace mongo { * @param waitForDelete wait for deletes to complete after each chunk move * @return number of chunks effectively moved */ - int _moveChunks(const std::vector<boost::shared_ptr<MigrateInfo>>& candidateChunks, + int _moveChunks(const std::vector<std::shared_ptr<MigrateInfo>>& candidateChunks, const WriteConcernOptions* writeConcern, bool waitForDelete); diff --git a/src/mongo/s/balancer_policy.cpp b/src/mongo/s/balancer_policy.cpp index 42b90d8cfe5..30cda3e06f2 100644 --- a/src/mongo/s/balancer_policy.cpp +++ b/src/mongo/s/balancer_policy.cpp @@ -255,7 +255,7 @@ namespace mongo { } for (const ShardType& shardData : shards) { - boost::shared_ptr<Shard> shard = + std::shared_ptr<Shard> shard = grid.shardRegistry()->findIfExists(shardData.getName()); // The shard must still exist in the registry. If it doesn't, which may happen in diff --git a/src/mongo/s/catalog/catalog_cache.cpp b/src/mongo/s/catalog/catalog_cache.cpp index 67563bcb002..ec32162f69a 100644 --- a/src/mongo/s/catalog/catalog_cache.cpp +++ b/src/mongo/s/catalog/catalog_cache.cpp @@ -30,7 +30,6 @@ #include "mongo/s/catalog/catalog_cache.h" -#include <boost/make_shared.hpp> #include "mongo/base/status_with.h" #include "mongo/s/catalog/catalog_manager.h" @@ -39,7 +38,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; @@ -63,7 +62,7 @@ namespace mongo { return status.getStatus(); } - shared_ptr<DBConfig> db = boost::make_shared<DBConfig>(dbName, status.getValue()); + shared_ptr<DBConfig> db = std::make_shared<DBConfig>(dbName, status.getValue()); db->load(); invariant(_databases.insert(std::make_pair(dbName, db)).second); diff --git a/src/mongo/s/catalog/catalog_cache.h b/src/mongo/s/catalog/catalog_cache.h index 8b4936a02d9..3f646100729 100644 --- a/src/mongo/s/catalog/catalog_cache.h +++ b/src/mongo/s/catalog/catalog_cache.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include <map> #include <string> @@ -61,7 +60,7 @@ namespace mongo { * @param dbname The name of the database (must not contain dots, etc). * @return The database if it exists, NULL otherwise. */ - StatusWith<boost::shared_ptr<DBConfig>> getDatabase(const std::string& dbName); + StatusWith<std::shared_ptr<DBConfig>> getDatabase(const std::string& dbName); /** * Removes the database information for the specified name from the cache, so that the @@ -75,7 +74,7 @@ namespace mongo { void invalidateAll(); private: - typedef std::map<std::string, boost::shared_ptr<DBConfig>> ShardedDatabasesMap; + typedef std::map<std::string, std::shared_ptr<DBConfig>> ShardedDatabasesMap; // Reference to the catalog manager. Not owned. diff --git a/src/mongo/s/catalog/catalog_manager.h b/src/mongo/s/catalog/catalog_manager.h index 56022dd6247..3130179c0b2 100644 --- a/src/mongo/s/catalog/catalog_manager.h +++ b/src/mongo/s/catalog/catalog_manager.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <set> #include <string> #include <vector> diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp index ffefe5829eb..cfc633e1b61 100644 --- a/src/mongo/s/chunk.cpp +++ b/src/mongo/s/chunk.cpp @@ -56,7 +56,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::map; using std::ostringstream; diff --git a/src/mongo/s/chunk.h b/src/mongo/s/chunk.h index 1f7a17f08d0..6e3bd2bc5b6 100644 --- a/src/mongo/s/chunk.h +++ b/src/mongo/s/chunk.h @@ -30,7 +30,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/db/keypattern.h" #include "mongo/platform/atomic_word.h" @@ -288,6 +287,6 @@ namespace mongo { static int mkDataWritten(); }; - typedef boost::shared_ptr<const Chunk> ChunkPtr; + typedef std::shared_ptr<const Chunk> ChunkPtr; } // namespace mongo diff --git a/src/mongo/s/chunk_diff.cpp b/src/mongo/s/chunk_diff.cpp index af50a432fc8..488ea85728b 100644 --- a/src/mongo/s/chunk_diff.cpp +++ b/src/mongo/s/chunk_diff.cpp @@ -32,7 +32,6 @@ #include "mongo/s/chunk_diff.h" -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclientinterface.h" #include "mongo/s/catalog/type_chunk.h" @@ -260,6 +259,6 @@ namespace mongo { // Ensures that these instances of the template are compiled template class ConfigDiffTracker<BSONObj, std::string>; - template class ConfigDiffTracker<boost::shared_ptr<Chunk>, std::string>; + template class ConfigDiffTracker<std::shared_ptr<Chunk>, std::string>; } // namespace mongo diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index c02b0fc7e75..dabdf8f97fe 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -55,7 +55,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::make_pair; using std::map; diff --git a/src/mongo/s/chunk_manager.h b/src/mongo/s/chunk_manager.h index d187abf81f5..995c7916f77 100644 --- a/src/mongo/s/chunk_manager.h +++ b/src/mongo/s/chunk_manager.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <map> #include <string> #include <vector> @@ -42,10 +41,10 @@ namespace mongo { class CollectionType; struct QuerySolutionNode; - typedef boost::shared_ptr<ChunkManager> ChunkManagerPtr; + typedef std::shared_ptr<ChunkManager> ChunkManagerPtr; // The key for the map is max for each Chunk or ChunkRange - typedef std::map<BSONObj, boost::shared_ptr<Chunk>, BSONObjCmp> ChunkMap; + typedef std::map<BSONObj, std::shared_ptr<Chunk>, BSONObjCmp> ChunkMap; class ChunkRange { @@ -78,7 +77,7 @@ namespace mongo { const BSONObj _max; }; - typedef std::map<BSONObj, boost::shared_ptr<ChunkRange>, BSONObjCmp> ChunkRangeMap; + typedef std::map<BSONObj, std::shared_ptr<ChunkRange>, BSONObjCmp> ChunkRangeMap; class ChunkRangeManager { @@ -206,7 +205,7 @@ namespace mongo { int getCurrentDesiredChunkSize() const; - boost::shared_ptr<ChunkManager> reload(bool force = true) const; // doesn't modify self! + std::shared_ptr<ChunkManager> reload(bool force = true) const; // doesn't modify self! private: // returns true if load was consistent diff --git a/src/mongo/s/chunk_manager_targeter.cpp b/src/mongo/s/chunk_manager_targeter.cpp index aaeabc390b0..ae3e79192ef 100644 --- a/src/mongo/s/chunk_manager_targeter.cpp +++ b/src/mongo/s/chunk_manager_targeter.cpp @@ -41,7 +41,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using mongoutils::str::stream; using std::map; using std::set; diff --git a/src/mongo/s/chunk_manager_targeter.h b/src/mongo/s/chunk_manager_targeter.h index 30d715e329d..3c5b9d68a09 100644 --- a/src/mongo/s/chunk_manager_targeter.h +++ b/src/mongo/s/chunk_manager_targeter.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <map> #include "mongo/bson/bsonobj.h" @@ -156,8 +155,8 @@ namespace mongo { // Zero or one of these are filled at all times // If sharded, _manager, if unsharded, _primary, on error, neither - boost::shared_ptr<ChunkManager> _manager; - boost::shared_ptr<Shard> _primary; + std::shared_ptr<ChunkManager> _manager; + std::shared_ptr<Shard> _primary; // Map of shard->remote shard version reported from stale errors ShardVersionMap _remoteShardVersions; diff --git a/src/mongo/s/client/multi_host_query.cpp b/src/mongo/s/client/multi_host_query.cpp index 294cfce2afd..a4fb70fffef 100644 --- a/src/mongo/s/client/multi_host_query.cpp +++ b/src/mongo/s/client/multi_host_query.cpp @@ -34,7 +34,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::make_pair; using std::string; using std::vector; @@ -65,7 +65,7 @@ namespace mongo { _context->workScheduledCV.notify_one(); } - void HostThreadPool::doWork(boost::shared_ptr<PoolContext> context) { + void HostThreadPool::doWork(std::shared_ptr<PoolContext> context) { while (true) { diff --git a/src/mongo/s/client/multi_host_query.h b/src/mongo/s/client/multi_host_query.h index 2fb7086b81d..f50d8c3cd35 100644 --- a/src/mongo/s/client/multi_host_query.h +++ b/src/mongo/s/client/multi_host_query.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/smart_ptr/shared_ptr.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/thread.hpp> @@ -169,7 +168,7 @@ namespace mongo { HostThreadPools* _hostThreads; // Outstanding requests - typedef std::map<ConnectionString, boost::shared_ptr<PendingQueryContext> > PendingMap; + typedef std::map<ConnectionString, std::shared_ptr<PendingQueryContext> > PendingMap; PendingMap _pending; // Synchronizes below @@ -316,7 +315,7 @@ namespace mongo { /** * Worker loop run by each thread. */ - static void doWork(boost::shared_ptr<PoolContext> context); + static void doWork(std::shared_ptr<PoolContext> context); const bool _scopeAllWork; @@ -324,6 +323,6 @@ namespace mongo { std::vector<boost::thread*> _threads; // Shared work and worker activity information - boost::shared_ptr<PoolContext> _context; + std::shared_ptr<PoolContext> _context; }; } diff --git a/src/mongo/s/client/multi_host_query_test.cpp b/src/mongo/s/client/multi_host_query_test.cpp index b70dfe9d75a..d63c4d311c8 100644 --- a/src/mongo/s/client/multi_host_query_test.cpp +++ b/src/mongo/s/client/multi_host_query_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/base/status_with.h" #include "mongo/s/client/multi_host_query.h" @@ -39,7 +38,7 @@ namespace { using namespace mongo; using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::make_pair; using std::map; using std::string; diff --git a/src/mongo/s/client/shard.h b/src/mongo/s/client/shard.h index c52dfd3d039..456df05303c 100644 --- a/src/mongo/s/client/shard.h +++ b/src/mongo/s/client/shard.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include "mongo/base/disallow_copying.h" @@ -62,7 +61,7 @@ namespace mongo { }; class Shard; - using ShardPtr = boost::shared_ptr<Shard>; + using ShardPtr = std::shared_ptr<Shard>; /* * Maintains the targeting and command execution logic for a single shard. Performs polling of diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp index 225b4c80b05..079783d5f7d 100644 --- a/src/mongo/s/client/shard_connection.cpp +++ b/src/mongo/s/client/shard_connection.cpp @@ -416,7 +416,7 @@ namespace { ShardConnection::ShardConnection(const ConnectionString& connectionString, const string& ns, - boost::shared_ptr<ChunkManager> manager) + std::shared_ptr<ChunkManager> manager) : _cs(connectionString), _ns(ns), _manager(manager) { diff --git a/src/mongo/s/client/shard_connection.h b/src/mongo/s/client/shard_connection.h index 41af573320a..4fc7f0f01a8 100644 --- a/src/mongo/s/client/shard_connection.h +++ b/src/mongo/s/client/shard_connection.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include "mongo/client/connpool.h" @@ -37,14 +36,14 @@ namespace mongo { class ChunkManager; - typedef boost::shared_ptr<ChunkManager> ChunkManagerPtr; + typedef std::shared_ptr<ChunkManager> ChunkManagerPtr; class ShardConnection : public AScopedConnection { public: ShardConnection(const ConnectionString& connectionString, const std::string& ns, - boost::shared_ptr<ChunkManager> manager = nullptr); + std::shared_ptr<ChunkManager> manager = nullptr); ~ShardConnection(); @@ -86,7 +85,7 @@ namespace mongo { return _ns; } - boost::shared_ptr<ChunkManager> getManager() const { + std::shared_ptr<ChunkManager> getManager() const { return _manager; } @@ -131,7 +130,7 @@ namespace mongo { const ConnectionString _cs; const std::string _ns; - boost::shared_ptr<ChunkManager> _manager; + std::shared_ptr<ChunkManager> _manager; bool _finishedInit; @@ -152,7 +151,7 @@ namespace mongo { BSONObj& result); - typedef boost::shared_ptr<ShardConnection> ShardConnectionPtr; + typedef std::shared_ptr<ShardConnection> ShardConnectionPtr; extern DBConnectionPool shardConnectionPool; diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp index bec9c3ca3c4..ccb95f9e65b 100644 --- a/src/mongo/s/client/shard_registry.cpp +++ b/src/mongo/s/client/shard_registry.cpp @@ -32,7 +32,6 @@ #include "mongo/s/client/shard_registry.h" -#include <boost/make_shared.hpp> #include <boost/thread/lock_guard.hpp> #include "mongo/client/connection_string.h" @@ -49,7 +48,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; using std::vector; @@ -132,7 +131,7 @@ namespace mongo { } void ShardRegistry::set(const ShardId& id, const Shard& s) { - shared_ptr<Shard> ss(boost::make_shared<Shard>(s.getId(), s.getConnString())); + shared_ptr<Shard> ss(std::make_shared<Shard>(s.getId(), s.getConnString())); boost::lock_guard<boost::mutex> lk(_mutex); _lookup[id] = ss; @@ -207,7 +206,7 @@ namespace mongo { const ConnectionString& shardHost(shardHostStatus.getValue()); - shared_ptr<Shard> shard = boost::make_shared<Shard>(shardType.getName(), shardHost); + shared_ptr<Shard> shard = std::make_shared<Shard>(shardType.getName(), shardHost); _lookup[shardType.getName()] = shard; // Sync cluster connections (legacy config server) do not go through the normal targeting @@ -251,7 +250,7 @@ namespace mongo { return nullptr; } - boost::shared_ptr<RemoteCommandTargeter> ShardRegistry::_findTargeter(const string& shardId) { + std::shared_ptr<RemoteCommandTargeter> ShardRegistry::_findTargeter(const string& shardId) { boost::lock_guard<boost::mutex> lk(_mutex); TargeterMap::iterator it = _targeters.find(shardId); diff --git a/src/mongo/s/client/shard_registry.h b/src/mongo/s/client/shard_registry.h index 22b19bfbb3f..9eeca1e972c 100644 --- a/src/mongo/s/client/shard_registry.h +++ b/src/mongo/s/client/shard_registry.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include <string> #include <vector> @@ -61,7 +60,7 @@ namespace executor { ~ShardRegistry(); - boost::shared_ptr<RemoteCommandTargeter> getTargeterForShard(const std::string& shardId); + std::shared_ptr<RemoteCommandTargeter> getTargeterForShard(const std::string& shardId); RemoteCommandRunner* getCommandRunner() const { return _commandRunner.get(); } @@ -69,7 +68,7 @@ namespace executor { void reload(); - boost::shared_ptr<Shard> findIfExists(const ShardId& id); + std::shared_ptr<Shard> findIfExists(const ShardId& id); /** * Lookup shard by replica set name. Returns nullptr if the name can't be found. @@ -87,17 +86,17 @@ namespace executor { void toBSON(BSONObjBuilder* result) const; private: - typedef std::map<ShardId, boost::shared_ptr<Shard>> ShardMap; - typedef std::map<ShardId, boost::shared_ptr<RemoteCommandTargeter>> TargeterMap; + typedef std::map<ShardId, std::shared_ptr<Shard>> ShardMap; + typedef std::map<ShardId, std::shared_ptr<RemoteCommandTargeter>> TargeterMap; /** * Creates a shard based on the specified information and puts it into the lookup maps. */ void _addShard_inlock(const ShardType& shardType); - boost::shared_ptr<Shard> _findUsingLookUp(const ShardId& shardId); + std::shared_ptr<Shard> _findUsingLookUp(const ShardId& shardId); - boost::shared_ptr<RemoteCommandTargeter> _findTargeter(const std::string& shardId); + std::shared_ptr<RemoteCommandTargeter> _findTargeter(const std::string& shardId); // Factory to obtain remote command targeters for shards const std::unique_ptr<RemoteCommandTargeterFactory> _targeterFactory; diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp index 0fcc15e539d..4d6e5b878b5 100644 --- a/src/mongo/s/cluster_write.cpp +++ b/src/mongo/s/cluster_write.cpp @@ -51,7 +51,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::vector; using std::map; diff --git a/src/mongo/s/collection_metadata.h b/src/mongo/s/collection_metadata.h index ee0b72432f9..b7f30c6a760 100644 --- a/src/mongo/s/collection_metadata.h +++ b/src/mongo/s/collection_metadata.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include "mongo/base/disallow_copying.h" #include "mongo/base/owned_pointer_vector.h" @@ -43,7 +42,7 @@ namespace mongo { class MetadataLoader; class CollectionMetadata; - typedef boost::shared_ptr<const CollectionMetadata> CollectionMetadataPtr; + typedef std::shared_ptr<const CollectionMetadata> CollectionMetadataPtr; /** * The collection metadata has metadata information about a collection, in particular the diff --git a/src/mongo/s/commands/cluster_drop_database_cmd.cpp b/src/mongo/s/commands/cluster_drop_database_cmd.cpp index 0faec0443ec..0cf6eec2f20 100644 --- a/src/mongo/s/commands/cluster_drop_database_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_database_cmd.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/base/status.h" #include "mongo/db/commands.h" @@ -41,7 +40,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; namespace { diff --git a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp index a8268520aa1..486906aaf4a 100644 --- a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp +++ b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_type.h" @@ -43,7 +42,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; namespace { @@ -104,7 +103,7 @@ namespace { return appendCommandStatus(result, status.getStatus()); } - boost::shared_ptr<DBConfig> config = status.getValue(); + std::shared_ptr<DBConfig> config = status.getValue(); if (!config->isSharded(nss.ns())) { return appendCommandStatus(result, Status(ErrorCodes::NamespaceNotSharded, "ns [" + nss.ns() + " is not sharded.")); diff --git a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp index f831a01355d..584b0831afb 100644 --- a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp +++ b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <map> #include <set> #include <string> @@ -56,7 +55,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::map; using std::set; using std::string; diff --git a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp index 068cbdc3dff..26eeece06fc 100644 --- a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp +++ b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/client/connpool.h" #include "mongo/db/auth/action_type.h" @@ -46,7 +45,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; using std::stringstream; using std::vector; @@ -138,7 +137,7 @@ namespace { return appendCommandStatus(result, status.getStatus()); } - boost::shared_ptr<DBConfig> config = status.getValue(); + std::shared_ptr<DBConfig> config = status.getValue(); if (!config->isSharded(nss.ns())) { return appendCommandStatus(result, Status(ErrorCodes::NamespaceNotSharded, "ns [" + nss.ns() + " is not sharded.")); diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp index 19aa53538da..5cbcbcefe50 100644 --- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/audit.h" #include "mongo/db/auth/action_set.h" @@ -51,7 +50,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::string; @@ -113,7 +112,7 @@ namespace { const NamespaceString nss(parseNs(dbname, cmdObj)); - boost::shared_ptr<DBConfig> config; + std::shared_ptr<DBConfig> config; { if (nss.size() == 0) { diff --git a/src/mongo/s/commands/cluster_move_primary_cmd.cpp b/src/mongo/s/commands/cluster_move_primary_cmd.cpp index caf911cd7ca..73bb006f2ae 100644 --- a/src/mongo/s/commands/cluster_move_primary_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_primary_cmd.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <set> #include "mongo/client/connpool.h" @@ -52,7 +51,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::set; using std::string; diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp index ebd402eee80..e2640af24cd 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp +++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" #include <boost/intrusive_ptr.hpp> -#include <boost/shared_ptr.hpp> #include <string> #include <utility> #include <vector> @@ -56,7 +55,7 @@ namespace mongo { using boost::intrusive_ptr; using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::string; using std::vector; diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp index c6186e81a93..85a5b2cbf82 100644 --- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp +++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <list> #include <set> #include <vector> @@ -56,7 +55,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::list; using std::set; using std::string; diff --git a/src/mongo/s/commands/cluster_split_collection_cmd.cpp b/src/mongo/s/commands/cluster_split_collection_cmd.cpp index ad14ff71199..acd99d32c7b 100644 --- a/src/mongo/s/commands/cluster_split_collection_cmd.cpp +++ b/src/mongo/s/commands/cluster_split_collection_cmd.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include <string> #include <vector> @@ -50,7 +49,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; using std::vector; @@ -118,7 +117,7 @@ namespace { return appendCommandStatus(result, status.getStatus()); } - boost::shared_ptr<DBConfig> config = status.getValue(); + std::shared_ptr<DBConfig> config = status.getValue(); if (!config->isSharded(nss.ns())) { config->reload(); diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index 733f498c5ab..9c9b2044b94 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -32,7 +32,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/client/connpool.h" #include "mongo/client/parallel.h" @@ -70,7 +69,7 @@ namespace mongo { using boost::intrusive_ptr; using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::list; using std::make_pair; using std::map; diff --git a/src/mongo/s/commands/run_on_all_shards_cmd.cpp b/src/mongo/s/commands/run_on_all_shards_cmd.cpp index 17445dd74db..c29b0ff1801 100644 --- a/src/mongo/s/commands/run_on_all_shards_cmd.cpp +++ b/src/mongo/s/commands/run_on_all_shards_cmd.cpp @@ -35,7 +35,6 @@ #include <list> #include <set> -#include <boost/shared_ptr.hpp> #include "mongo/db/jsobj.h" #include "mongo/client/parallel.h" @@ -82,7 +81,7 @@ namespace mongo { getShardIds(dbName, cmdObj, shardIds); // TODO: Future is deprecated, replace with commandOp() - std::list< boost::shared_ptr<Future::CommandResult> > futures; + std::list< std::shared_ptr<Future::CommandResult> > futures; for (const ShardId& shardId : shardIds) { const auto& shard = grid.shardRegistry()->findIfExists(shardId); if (!shard) { @@ -102,7 +101,7 @@ namespace mongo { BSONObjBuilder errors; int commonErrCode = -1; - std::list< boost::shared_ptr<Future::CommandResult> >::iterator futuresit; + std::list< std::shared_ptr<Future::CommandResult> >::iterator futuresit; std::vector<ShardId>::const_iterator shardIdsIt; // We iterate over the set of shard ids and their corresponding futures in parallel. // TODO: replace with zip iterator if we ever decide to use one from Boost or elsewhere @@ -110,7 +109,7 @@ namespace mongo { futuresit != futures.end() && shardIdsIt != shardIds.end(); ++futuresit, ++shardIdsIt) { - boost::shared_ptr<Future::CommandResult> res = *futuresit; + std::shared_ptr<Future::CommandResult> res = *futuresit; if ( res->join() ) { // success :) diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp index 506627aaadd..4180d522f92 100644 --- a/src/mongo/s/config.cpp +++ b/src/mongo/s/config.cpp @@ -217,8 +217,8 @@ namespace mongo { // Handles weird logic related to getting *either* a chunk manager *or* the collection primary shard void DBConfig::getChunkManagerOrPrimary(const string& ns, - boost::shared_ptr<ChunkManager>& manager, - boost::shared_ptr<Shard>& primary) { + std::shared_ptr<ChunkManager>& manager, + std::shared_ptr<Shard>& primary) { // The logic here is basically that at any time, our collection can become sharded or unsharded // via a command. If we're not sharded, we want to send data to the primary, if sharded, we want @@ -274,7 +274,7 @@ namespace mongo { } } - boost::shared_ptr<ChunkManager> DBConfig::getChunkManager(const string& ns, + std::shared_ptr<ChunkManager> DBConfig::getChunkManager(const string& ns, bool shouldReload, bool forceReload) { BSONObj key; diff --git a/src/mongo/s/config.h b/src/mongo/s/config.h index e5f42e2eb38..e15d8e54ee0 100644 --- a/src/mongo/s/config.h +++ b/src/mongo/s/config.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <set> #include "mongo/db/jsobj.h" @@ -42,7 +41,7 @@ namespace mongo { class DatabaseType; class DBConfig; - typedef boost::shared_ptr<DBConfig> DBConfigPtr; + typedef std::shared_ptr<DBConfig> DBConfigPtr; struct CollectionInfo { CollectionInfo() { @@ -57,7 +56,7 @@ namespace mongo { return _cm.get(); } - boost::shared_ptr<ChunkManager> getCM() const { + std::shared_ptr<ChunkManager> getCM() const { return _cm; } @@ -71,7 +70,7 @@ namespace mongo { void save(const std::string& ns); - void useChunkManager(boost::shared_ptr<ChunkManager> manager); + void useChunkManager(std::shared_ptr<ChunkManager> manager); bool unique() const { return _unique; } BSONObj key() const { return _key; } @@ -79,7 +78,7 @@ namespace mongo { private: BSONObj _key; bool _unique; - boost::shared_ptr<ChunkManager> _cm; + std::shared_ptr<ChunkManager> _cm; bool _dirty; bool _dropped; }; @@ -118,11 +117,11 @@ namespace mongo { // Atomically returns *either* the chunk manager *or* the primary shard for the collection, // neither if the collection doesn't exist. void getChunkManagerOrPrimary(const std::string& ns, - boost::shared_ptr<ChunkManager>& manager, - boost::shared_ptr<Shard>& primary); + std::shared_ptr<ChunkManager>& manager, + std::shared_ptr<Shard>& primary); - boost::shared_ptr<ChunkManager> getChunkManager(const std::string& ns, bool reload = false, bool forceReload = false); - boost::shared_ptr<ChunkManager> getChunkManagerIfExists(const std::string& ns, bool reload = false, bool forceReload = false); + std::shared_ptr<ChunkManager> getChunkManager(const std::string& ns, bool reload = false, bool forceReload = false); + std::shared_ptr<ChunkManager> getChunkManagerIfExists(const std::string& ns, bool reload = false, bool forceReload = false); /** * Returns shard id for primary shard for the database for which this DBConfig represents. diff --git a/src/mongo/s/cursors.h b/src/mongo/s/cursors.h index 9520cfcc388..c3186156628 100644 --- a/src/mongo/s/cursors.h +++ b/src/mongo/s/cursors.h @@ -30,7 +30,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include "mongo/base/disallow_copying.h" @@ -92,7 +91,7 @@ namespace mongo { }; - typedef boost::shared_ptr<ShardedClientCursor> ShardedClientCursorPtr; + typedef std::shared_ptr<ShardedClientCursor> ShardedClientCursorPtr; class CursorCache { public: diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index 9b24ee44525..a74198e6464 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -1273,7 +1273,7 @@ namespace { // Resolve the shard connection strings. { - boost::shared_ptr<Shard> fromShard = + std::shared_ptr<Shard> fromShard = grid.shardRegistry()->findIfExists(fromShardName); uassert(28674, str::stream() << "Source shard " << fromShardName @@ -1282,7 +1282,7 @@ namespace { fromShardCS = fromShard->getConnString(); - boost::shared_ptr<Shard> toShard = grid.shardRegistry()->findIfExists(toShardName); + std::shared_ptr<Shard> toShard = grid.shardRegistry()->findIfExists(toShardName); uassert(28675, str::stream() << "Destination shard " << toShardName << " is missing. This indicates metadata corruption.", diff --git a/src/mongo/s/dbclient_shard_resolver.cpp b/src/mongo/s/dbclient_shard_resolver.cpp index 8ae3df53cec..7ee5c8cb493 100644 --- a/src/mongo/s/dbclient_shard_resolver.cpp +++ b/src/mongo/s/dbclient_shard_resolver.cpp @@ -43,7 +43,7 @@ namespace mongo { ConnectionString* shardHost) const { // Internally uses our shard cache, does no reload - boost::shared_ptr<Shard> shard = grid.shardRegistry()->findIfExists(shardName); + std::shared_ptr<Shard> shard = grid.shardRegistry()->findIfExists(shardName); if (!shard) { return Status(ErrorCodes::ShardNotFound, str::stream() << "unknown shard name " << shardName); diff --git a/src/mongo/s/distlock_test.cpp b/src/mongo/s/distlock_test.cpp index 4a13609fe9f..8cf82627a46 100644 --- a/src/mongo/s/distlock_test.cpp +++ b/src/mongo/s/distlock_test.cpp @@ -33,7 +33,6 @@ #include "mongo/s/catalog/legacy/distlock.h" -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <iostream> #include <vector> @@ -78,7 +77,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::string; using std::stringstream; diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp index b24f195d356..d687a7f8129 100644 --- a/src/mongo/s/grid.cpp +++ b/src/mongo/s/grid.cpp @@ -57,7 +57,7 @@ namespace mongo { _shardRegistry = std::move(shardRegistry); } - StatusWith<boost::shared_ptr<DBConfig>> Grid::implicitCreateDb(const std::string& dbName) { + StatusWith<std::shared_ptr<DBConfig>> Grid::implicitCreateDb(const std::string& dbName) { auto status = catalogCache()->getDatabase(dbName); if (status.isOK()) { return status; diff --git a/src/mongo/s/grid.h b/src/mongo/s/grid.h index e8dc9c2e7c3..d15768ae21e 100644 --- a/src/mongo/s/grid.h +++ b/src/mongo/s/grid.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <string> #include <vector> @@ -67,7 +66,7 @@ namespace mongo { /** * Implicitly creates the specified database as non-sharded. */ - StatusWith<boost::shared_ptr<DBConfig>> implicitCreateDb(const std::string& dbName); + StatusWith<std::shared_ptr<DBConfig>> implicitCreateDb(const std::string& dbName); /** * @return true if shards and config servers are allowed to use 'localhost' in address diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 89aa85aec11..3b19bf17658 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -32,7 +32,6 @@ #include "mongo/s/server.h" -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include "mongo/base/init.h" @@ -268,7 +267,7 @@ static ExitCode runMongosServer( bool doUpgrade ) { #endif if (serverGlobalParams.isHttpInterfaceEnabled) { - boost::shared_ptr<DbWebServer> dbWebServer( + std::shared_ptr<DbWebServer> dbWebServer( new DbWebServer(serverGlobalParams.bind_ip, serverGlobalParams.port + 1000, new NoAdminAccess())); diff --git a/src/mongo/s/shard_key_pattern.cpp b/src/mongo/s/shard_key_pattern.cpp index d4c5e105450..f53c20136ef 100644 --- a/src/mongo/s/shard_key_pattern.cpp +++ b/src/mongo/s/shard_key_pattern.cpp @@ -28,7 +28,6 @@ #include "mongo/s/shard_key_pattern.h" -#include <boost/shared_ptr.hpp> #include <vector> #include "mongo/db/field_ref.h" @@ -42,7 +41,7 @@ namespace mongo { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::pair; using std::make_pair; diff --git a/src/mongo/s/strategy.cpp b/src/mongo/s/strategy.cpp index 5fa32cba9bd..784bca5c545 100644 --- a/src/mongo/s/strategy.cpp +++ b/src/mongo/s/strategy.cpp @@ -70,7 +70,7 @@ namespace mongo { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::set; using std::string; diff --git a/src/mongo/s/version_manager.cpp b/src/mongo/s/version_manager.cpp index 9d6b3725984..69cacfaeebc 100644 --- a/src/mongo/s/version_manager.cpp +++ b/src/mongo/s/version_manager.cpp @@ -34,7 +34,6 @@ #include "mongo/s/version_manager.h" -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclient_rs.h" #include "mongo/db/namespace_string.h" @@ -52,7 +51,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::map; using std::string; diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index e42a3db8186..f7275d8235d 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -35,7 +35,6 @@ #include <cctype> #include <boost/filesystem/operations.hpp> -#include <boost/shared_ptr.hpp> #include "mongo/client/dbclientcursor.h" #include "mongo/client/dbclientinterface.h" @@ -49,7 +48,7 @@ namespace mongo { using std::unique_ptr; - using boost::shared_ptr; + using std::shared_ptr; using std::unique_ptr; using std::endl; using std::set; @@ -314,7 +313,7 @@ namespace { namespace { class ScopeCache { public: - void release(const string& poolName, const boost::shared_ptr<Scope>& scope) { + void release(const string& poolName, const std::shared_ptr<Scope>& scope) { boost::lock_guard<boost::mutex> lk(_mutex); if (scope->hasOutOfMemoryException()) { @@ -340,12 +339,12 @@ namespace { _pools.push_front(toStore); } - boost::shared_ptr<Scope> tryAcquire(OperationContext* txn, const string& poolName) { + std::shared_ptr<Scope> tryAcquire(OperationContext* txn, const string& poolName) { boost::lock_guard<boost::mutex> lk(_mutex); for (Pools::iterator it = _pools.begin(); it != _pools.end(); ++it) { if (it->poolName == poolName) { - boost::shared_ptr<Scope> scope = it->scope; + std::shared_ptr<Scope> scope = it->scope; _pools.erase(it); scope->incTimesUsed(); scope->reset(); @@ -354,12 +353,12 @@ namespace { } } - return boost::shared_ptr<Scope>(); + return std::shared_ptr<Scope>(); } private: struct ScopeAndPool { - boost::shared_ptr<Scope> scope; + std::shared_ptr<Scope> scope; string poolName; }; @@ -377,7 +376,7 @@ namespace { class PooledScope : public Scope { public: - PooledScope(const std::string& pool, const boost::shared_ptr<Scope>& real) + PooledScope(const std::string& pool, const std::shared_ptr<Scope>& real) : _pool(pool) , _real(real) { @@ -452,7 +451,7 @@ namespace { private: string _pool; - boost::shared_ptr<Scope> _real; + std::shared_ptr<Scope> _real; }; /** Get a scope from the pool of scopes matching the supplied pool name */ @@ -460,7 +459,7 @@ namespace { const string& db, const string& scopeType) { const string fullPoolName = db + scopeType; - boost::shared_ptr<Scope> s = scopeCache.tryAcquire(txn, fullPoolName); + std::shared_ptr<Scope> s = scopeCache.tryAcquire(txn, fullPoolName); if (!s) { s.reset(newScope()); s->registerOperation(txn); diff --git a/src/mongo/scripting/engine_v8-3.25.h b/src/mongo/scripting/engine_v8-3.25.h index b81dfcc40f6..efe100ac776 100644 --- a/src/mongo/scripting/engine_v8-3.25.h +++ b/src/mongo/scripting/engine_v8-3.25.h @@ -29,7 +29,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <v8.h> #include <set> #include <string> @@ -115,7 +114,7 @@ namespace mongo { _objPtr(instance), _tracker(tracker) { } v8::Persistent<v8::Value> _instanceHandle; - boost::shared_ptr<_ObjType> _objPtr; + std::shared_ptr<_ObjType> _objPtr; ObjTracker<_ObjType>* _tracker; }; @@ -338,10 +337,10 @@ namespace mongo { // Track both cursor and connection. // This ensures the connection outlives the cursor. struct DBConnectionAndCursor { - boost::shared_ptr<DBClientBase> conn; - boost::shared_ptr<DBClientCursor> cursor; - DBConnectionAndCursor(boost::shared_ptr<DBClientBase> conn, - boost::shared_ptr<DBClientCursor> cursor) + std::shared_ptr<DBClientBase> conn; + std::shared_ptr<DBClientCursor> cursor; + DBConnectionAndCursor(std::shared_ptr<DBClientBase> conn, + std::shared_ptr<DBClientCursor> cursor) : conn(conn), cursor(cursor) { } }; ObjTracker<DBConnectionAndCursor> dbConnectionAndCursor; diff --git a/src/mongo/scripting/engine_v8.h b/src/mongo/scripting/engine_v8.h index 3e2b25c3507..6c3b482aea3 100644 --- a/src/mongo/scripting/engine_v8.h +++ b/src/mongo/scripting/engine_v8.h @@ -29,7 +29,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <v8.h> #include <vector> @@ -107,7 +106,7 @@ namespace mongo { TrackedPtr(_ObjType* instance, ObjTracker<_ObjType>* tracker) : _objPtr(instance), _tracker(tracker) { } - boost::shared_ptr<_ObjType> _objPtr; + std::shared_ptr<_ObjType> _objPtr; ObjTracker<_ObjType>* _tracker; }; @@ -329,10 +328,10 @@ namespace mongo { // Track both cursor and connection. // This ensures the connection outlives the cursor. struct DBConnectionAndCursor { - boost::shared_ptr<DBClientBase> conn; - boost::shared_ptr<DBClientCursor> cursor; - DBConnectionAndCursor(boost::shared_ptr<DBClientBase> conn, - boost::shared_ptr<DBClientCursor> cursor) + std::shared_ptr<DBClientBase> conn; + std::shared_ptr<DBClientCursor> cursor; + DBConnectionAndCursor(std::shared_ptr<DBClientBase> conn, + std::shared_ptr<DBClientCursor> cursor) : conn(conn), cursor(cursor) { } }; ObjTracker<DBConnectionAndCursor> dbConnectionAndCursor; diff --git a/src/mongo/scripting/v8-3.25_db.cpp b/src/mongo/scripting/v8-3.25_db.cpp index f4fe7d6a88d..147dcbbf563 100644 --- a/src/mongo/scripting/v8-3.25_db.cpp +++ b/src/mongo/scripting/v8-3.25_db.cpp @@ -31,7 +31,6 @@ #include <iostream> #include <iomanip> -#include <boost/shared_ptr.hpp> #include "mongo/base/init.h" #include "mongo/client/sasl_client_authenticate.h" @@ -46,7 +45,7 @@ using namespace std; using std::unique_ptr; -using boost::shared_ptr; +using std::shared_ptr; namespace mongo { @@ -186,14 +185,14 @@ namespace mongo { return v8::Undefined(scope->getIsolate()); } - boost::shared_ptr<mongo::DBClientBase> getConnection(V8Scope* scope, + std::shared_ptr<mongo::DBClientBase> getConnection(V8Scope* scope, const v8::FunctionCallbackInfo<v8::Value>& args) { verify(scope->MongoFT()->HasInstance(args.This())); verify(args.This()->InternalFieldCount() == 1); v8::Local<v8::External> c = v8::Local<v8::External>::Cast(args.This()->GetInternalField(0)); - boost::shared_ptr<DBClientBase>* conn = - static_cast<boost::shared_ptr<DBClientBase>*>(c->Value()); + std::shared_ptr<DBClientBase>* conn = + static_cast<std::shared_ptr<DBClientBase>*>(c->Value()); massert(16667, "Unable to get db client connection", conn && conn->get()); return *conn; } @@ -205,7 +204,7 @@ namespace mongo { const v8::FunctionCallbackInfo<v8::Value>& args) { argumentCheck(args.Length() == 7, "find needs 7 args") argumentCheck(args[1]->IsObject(), "needs to be an object") - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); BSONObj fields; BSONObj q = scope->v8ToMongo(args[1]->ToObject()); @@ -214,7 +213,7 @@ namespace mongo { if (haveFields) fields = scope->v8ToMongo(args[2]->ToObject()); - boost::shared_ptr<mongo::DBClientCursor> cursor; + std::shared_ptr<mongo::DBClientCursor> cursor; int nToReturn = args[3]->Int32Value(); int nToSkip = args[4]->Int32Value(); int batchSize = args[5]->Int32Value(); @@ -239,11 +238,11 @@ namespace mongo { argumentCheck(scope->NumberLongFT()->HasInstance(args[1]), "2nd arg must be a NumberLong") argumentCheck(args[2]->IsUndefined() || args[2]->IsNumber(), "3rd arg must be a js Number") - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); long long cursorId = numberLongVal(scope, args[1]->ToObject()); - boost::shared_ptr<mongo::DBClientCursor> cursor( + std::shared_ptr<mongo::DBClientCursor> cursor( new DBClientCursor(conn.get(), ns, cursorId, 0, 0)); if (!args[2]->IsUndefined()) @@ -268,7 +267,7 @@ namespace mongo { return v8AssertionException("js db in read only mode"); } - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); v8::Local<v8::Integer> flags = args[2]->ToInteger(); @@ -317,7 +316,7 @@ namespace mongo { return v8AssertionException("js db in read only mode"); } - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); v8::Local<v8::Object> in = args[1]->ToObject(); @@ -344,7 +343,7 @@ namespace mongo { return v8AssertionException("js db in read only mode"); } - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); v8::Local<v8::Object> q = args[1]->ToObject(); @@ -361,7 +360,7 @@ namespace mongo { v8::Local<v8::Value> mongoAuth(V8Scope* scope, const v8::FunctionCallbackInfo<v8::Value>& args) { - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); if (NULL == conn) return v8AssertionException("no connection"); @@ -391,7 +390,7 @@ namespace mongo { v8::Local<v8::Value> mongoLogout(V8Scope* scope, const v8::FunctionCallbackInfo<v8::Value>& args) { argumentCheck(args.Length() == 1, "logout needs 1 arg") - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string db = toSTLString(args[0]); BSONObj ret; conn->logout(db, ret); diff --git a/src/mongo/scripting/v8-3.25_utils.cpp b/src/mongo/scripting/v8-3.25_utils.cpp index 9b183cf0b81..ef90819cdbb 100644 --- a/src/mongo/scripting/v8-3.25_utils.cpp +++ b/src/mongo/scripting/v8-3.25_utils.cpp @@ -31,10 +31,8 @@ #include "mongo/scripting/v8-3.25_utils.h" -#include <boost/make_shared.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/xtime.hpp> #include <iostream> @@ -235,13 +233,13 @@ namespace mongo { } private: - boost::shared_ptr<SharedData> _sharedData; + std::shared_ptr<SharedData> _sharedData; }; bool _started; bool _done; unique_ptr<boost::thread> _thread; - boost::shared_ptr<SharedData> _sharedData; + std::shared_ptr<SharedData> _sharedData; }; class CountDownLatchHolder { @@ -253,14 +251,14 @@ namespace mongo { int32_t count; }; - boost::shared_ptr<Latch> get(int32_t desc) { + std::shared_ptr<Latch> get(int32_t desc) { boost::lock_guard<boost::mutex> lock(_mutex); Map::iterator iter = _latches.find(desc); jsassert(iter != _latches.end(), "not a valid CountDownLatch descriptor"); return iter->second; } - typedef std::map< int32_t, boost::shared_ptr<Latch> > Map; + typedef std::map< int32_t, std::shared_ptr<Latch> > Map; Map _latches; boost::mutex _mutex; int32_t _counter; @@ -270,18 +268,18 @@ namespace mongo { jsassert(count >= 0, "argument must be >= 0"); boost::lock_guard<boost::mutex> lock(_mutex); int32_t desc = ++_counter; - _latches.insert(std::make_pair(desc, boost::make_shared<Latch>(count))); + _latches.insert(std::make_pair(desc, std::make_shared<Latch>(count))); return desc; } void await(int32_t desc) { - boost::shared_ptr<Latch> latch = get(desc); + std::shared_ptr<Latch> latch = get(desc); boost::unique_lock<boost::mutex> lock(latch->mutex); while (latch->count != 0) { latch->cv.wait(lock); } } void countDown(int32_t desc) { - boost::shared_ptr<Latch> latch = get(desc); + std::shared_ptr<Latch> latch = get(desc); boost::unique_lock<boost::mutex> lock(latch->mutex); if (latch->count > 0) { latch->count--; @@ -291,7 +289,7 @@ namespace mongo { } } int32_t getCount(int32_t desc) { - boost::shared_ptr<Latch> latch = get(desc); + std::shared_ptr<Latch> latch = get(desc); boost::unique_lock<boost::mutex> lock(latch->mutex); return latch->count; } @@ -336,7 +334,7 @@ namespace mongo { v8::Local<v8::External> c = v8::Local<v8::External>::Cast( args.This()->GetHiddenValue(v8::String::NewFromUtf8(scope->getIsolate(), "_JSThreadConfig"))); - JSThreadConfig *config = static_cast<boost::shared_ptr<JSThreadConfig>*>(c->Value())->get(); + JSThreadConfig *config = static_cast<std::shared_ptr<JSThreadConfig>*>(c->Value())->get(); return config; } diff --git a/src/mongo/scripting/v8_db.cpp b/src/mongo/scripting/v8_db.cpp index 6d4fa2a4e2f..f793b81533c 100644 --- a/src/mongo/scripting/v8_db.cpp +++ b/src/mongo/scripting/v8_db.cpp @@ -31,7 +31,6 @@ #include <iostream> #include <iomanip> -#include <boost/shared_ptr.hpp> #include "mongo/base/init.h" #include "mongo/base/status_with.h" @@ -50,7 +49,7 @@ using namespace std; using std::unique_ptr; -using boost::shared_ptr; +using std::shared_ptr; namespace mongo { @@ -190,12 +189,12 @@ namespace mongo { return v8::Undefined(); } - boost::shared_ptr<DBClientBase> getConnection(V8Scope* scope, const v8::Arguments& args) { + std::shared_ptr<DBClientBase> getConnection(V8Scope* scope, const v8::Arguments& args) { verify(scope->MongoFT()->HasInstance(args.This())); verify(args.This()->InternalFieldCount() == 1); v8::Local<v8::External> c = v8::External::Cast(*(args.This()->GetInternalField(0))); - boost::shared_ptr<DBClientBase>* conn = - static_cast<boost::shared_ptr<DBClientBase>*>(c->Value()); + std::shared_ptr<DBClientBase>* conn = + static_cast<std::shared_ptr<DBClientBase>*>(c->Value()); massert(16667, "Unable to get db client connection", conn && conn->get()); return *conn; } @@ -208,7 +207,7 @@ namespace mongo { argumentCheck(args[0]->IsString(), "the database parameter to runCommand must be a string"); argumentCheck(args[1]->IsObject(), "the cmdObj parameter to runCommand must be an object"); argumentCheck(args[2]->IsNumber(), "the options parameter to runCommand must be a number"); - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string database = toSTLString(args[0]); BSONObj cmdObj = scope->v8ToMongo(args[1]->ToObject()); int queryOptions = args[2]->Int32Value(); @@ -224,7 +223,7 @@ namespace mongo { v8::Handle<v8::Value> mongoFind(V8Scope* scope, const v8::Arguments& args) { argumentCheck(args.Length() == 7, "find needs 7 args") argumentCheck(args[1]->IsObject(), "needs to be an object") - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); BSONObj fields; BSONObj q = scope->v8ToMongo(args[1]->ToObject()); @@ -233,7 +232,7 @@ namespace mongo { if (haveFields) fields = scope->v8ToMongo(args[2]->ToObject()); - boost::shared_ptr<mongo::DBClientCursor> cursor; + std::shared_ptr<mongo::DBClientCursor> cursor; int nToReturn = args[3]->Int32Value(); int nToSkip = args[4]->Int32Value(); int batchSize = args[5]->Int32Value(); @@ -258,11 +257,11 @@ namespace mongo { argumentCheck(scope->NumberLongFT()->HasInstance(args[1]), "2nd arg must be a NumberLong") argumentCheck(args[2]->IsUndefined() || args[2]->IsNumber(), "3rd arg must be a js Number") - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); long long cursorId = numberLongVal(scope, args[1]->ToObject()); - boost::shared_ptr<mongo::DBClientCursor> cursor( + std::shared_ptr<mongo::DBClientCursor> cursor( new DBClientCursor(conn.get(), ns, cursorId, 0, 0)); if (!args[2]->IsUndefined()) @@ -287,7 +286,7 @@ namespace mongo { return v8AssertionException("js db in read only mode"); } - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); v8::Handle<v8::Integer> flags = args[2]->ToInteger(); @@ -335,7 +334,7 @@ namespace mongo { return v8AssertionException("js db in read only mode"); } - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); v8::Handle<v8::Object> in = args[1]->ToObject(); @@ -361,7 +360,7 @@ namespace mongo { return v8AssertionException("js db in read only mode"); } - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string ns = toSTLString(args[0]); v8::Handle<v8::Object> q = args[1]->ToObject(); @@ -377,7 +376,7 @@ namespace mongo { } v8::Handle<v8::Value> mongoAuth(V8Scope* scope, const v8::Arguments& args) { - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); if (NULL == conn) return v8AssertionException("no connection"); @@ -406,7 +405,7 @@ namespace mongo { v8::Handle<v8::Value> mongoLogout(V8Scope* scope, const v8::Arguments& args) { argumentCheck(args.Length() == 1, "logout needs 1 arg") - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); const string db = toSTLString(args[0]); BSONObj ret; conn->logout(db, ret); @@ -414,7 +413,7 @@ namespace mongo { } v8::Handle<v8::Value> mongoCopyDatabaseWithSCRAM(V8Scope* scope, const v8::Arguments& args) { - boost::shared_ptr<DBClientBase> conn = getConnection(scope, args); + std::shared_ptr<DBClientBase> conn = getConnection(scope, args); if (NULL == conn) return v8AssertionException("no connection"); diff --git a/src/mongo/scripting/v8_deadline_monitor_test.cpp b/src/mongo/scripting/v8_deadline_monitor_test.cpp index f6f43bd8ff4..e0f06fd91ff 100644 --- a/src/mongo/scripting/v8_deadline_monitor_test.cpp +++ b/src/mongo/scripting/v8_deadline_monitor_test.cpp @@ -32,13 +32,12 @@ #include "mongo/scripting/v8_deadline_monitor.h" -#include <boost/shared_ptr.hpp> #include "mongo/unittest/unittest.h" namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::vector; class TaskGroup { diff --git a/src/mongo/scripting/v8_utils.cpp b/src/mongo/scripting/v8_utils.cpp index 7a774354c99..f9e53904ebe 100644 --- a/src/mongo/scripting/v8_utils.cpp +++ b/src/mongo/scripting/v8_utils.cpp @@ -31,10 +31,8 @@ #include "mongo/scripting/v8_utils.h" -#include <boost/make_shared.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/xtime.hpp> #include <iostream> @@ -232,13 +230,13 @@ namespace mongo { } private: - boost::shared_ptr<SharedData> _sharedData; + std::shared_ptr<SharedData> _sharedData; }; bool _started; bool _done; unique_ptr<boost::thread> _thread; - boost::shared_ptr<SharedData> _sharedData; + std::shared_ptr<SharedData> _sharedData; }; class CountDownLatchHolder { @@ -250,14 +248,14 @@ namespace mongo { int32_t count; }; - boost::shared_ptr<Latch> get(int32_t desc) { + std::shared_ptr<Latch> get(int32_t desc) { boost::lock_guard<boost::mutex> lock(_mutex); Map::iterator iter = _latches.find(desc); jsassert(iter != _latches.end(), "not a valid CountDownLatch descriptor"); return iter->second; } - typedef std::map< int32_t, boost::shared_ptr<Latch> > Map; + typedef std::map< int32_t, std::shared_ptr<Latch> > Map; Map _latches; boost::mutex _mutex; int32_t _counter; @@ -267,18 +265,18 @@ namespace mongo { jsassert(count >= 0, "argument must be >= 0"); boost::lock_guard<boost::mutex> lock(_mutex); int32_t desc = ++_counter; - _latches.insert(std::make_pair(desc, boost::make_shared<Latch>(count))); + _latches.insert(std::make_pair(desc, std::make_shared<Latch>(count))); return desc; } void await(int32_t desc) { - boost::shared_ptr<Latch> latch = get(desc); + std::shared_ptr<Latch> latch = get(desc); boost::unique_lock<boost::mutex> lock(latch->mutex); while (latch->count != 0) { latch->cv.wait(lock); } } void countDown(int32_t desc) { - boost::shared_ptr<Latch> latch = get(desc); + std::shared_ptr<Latch> latch = get(desc); boost::unique_lock<boost::mutex> lock(latch->mutex); if (latch->count > 0) { latch->count--; @@ -288,7 +286,7 @@ namespace mongo { } } int32_t getCount(int32_t desc) { - boost::shared_ptr<Latch> latch = get(desc); + std::shared_ptr<Latch> latch = get(desc); boost::unique_lock<boost::mutex> lock(latch->mutex); return latch->count; } @@ -327,7 +325,7 @@ namespace mongo { JSThreadConfig *thisConfig(V8Scope* scope, const v8::Arguments& args) { v8::Local<v8::External> c = v8::External::Cast( *(args.This()->GetHiddenValue(v8::String::New("_JSThreadConfig")))); - JSThreadConfig *config = static_cast<boost::shared_ptr<JSThreadConfig>*>(c->Value())->get(); + JSThreadConfig *config = static_cast<std::shared_ptr<JSThreadConfig>*>(c->Value())->get(); return config; } diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp index 151c0a6ed3b..bf5cc2c19f7 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -37,7 +37,6 @@ #include <pcrecpp.h> #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <iostream> @@ -198,25 +197,25 @@ namespace mongo { if ( ! args["trapPattern"].eoo() ){ const char* regex = args["trapPattern"].regex(); const char* flags = args["trapPattern"].regexFlags(); - this->trapPattern = boost::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); + this->trapPattern = std::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); } if ( ! args["noTrapPattern"].eoo() ){ const char* regex = args["noTrapPattern"].regex(); const char* flags = args["noTrapPattern"].regexFlags(); - this->noTrapPattern = boost::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); + this->noTrapPattern = std::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); } if ( ! args["watchPattern"].eoo() ){ const char* regex = args["watchPattern"].regex(); const char* flags = args["watchPattern"].regexFlags(); - this->watchPattern = boost::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); + this->watchPattern = std::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); } if ( ! args["noWatchPattern"].eoo() ){ const char* regex = args["noWatchPattern"].regex(); const char* flags = args["noWatchPattern"].regexFlags(); - this->noWatchPattern = boost::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); + this->noWatchPattern = std::shared_ptr< pcrecpp::RE >( new pcrecpp::RE( regex, flags2options( flags ) ) ); } this->ops = args["ops"].Obj().getOwned(); diff --git a/src/mongo/shell/bench.h b/src/mongo/shell/bench.h index 6edd007b6c6..f8242bfec69 100644 --- a/src/mongo/shell/bench.h +++ b/src/mongo/shell/bench.h @@ -30,7 +30,6 @@ #include <string> -#include <boost/shared_ptr.hpp> #include <boost/thread/condition.hpp> #include <boost/noncopyable.hpp> #include <boost/thread/mutex.hpp> @@ -108,10 +107,10 @@ namespace mongo { bool handleErrors; bool hideErrors; - boost::shared_ptr< pcrecpp::RE > trapPattern; - boost::shared_ptr< pcrecpp::RE > noTrapPattern; - boost::shared_ptr< pcrecpp::RE > watchPattern; - boost::shared_ptr< pcrecpp::RE > noWatchPattern; + std::shared_ptr< pcrecpp::RE > trapPattern; + std::shared_ptr< pcrecpp::RE > noTrapPattern; + std::shared_ptr< pcrecpp::RE > watchPattern; + std::shared_ptr< pcrecpp::RE > noWatchPattern; /** * Operation description. A BSON array of objects, each describing a single diff --git a/src/mongo/tools/sniffer.cpp b/src/mongo/tools/sniffer.cpp index d3be0dbefda..bc5dc2bd5de 100644 --- a/src/mongo/tools/sniffer.cpp +++ b/src/mongo/tools/sniffer.cpp @@ -44,7 +44,6 @@ #undef max #endif -#include <boost/shared_ptr.hpp> #include <ctype.h> #include <errno.h> #include <iostream> @@ -72,7 +71,7 @@ #include "mongo/util/text.h" using namespace std; -using boost::shared_ptr; +using std::shared_ptr; using mongo::Message; using mongo::DbMessage; using mongo::BSONObj; @@ -164,9 +163,9 @@ struct Connection { map< Connection, bool > seen; map< Connection, int > bytesRemainingInMessage; -map< Connection, boost::shared_ptr< BufBuilder > > messageBuilder; +map< Connection, std::shared_ptr< BufBuilder > > messageBuilder; map< Connection, unsigned > expectedSeq; -map< Connection, boost::shared_ptr<DBClientConnection> > forwarder; +map< Connection, std::shared_ptr<DBClientConnection> > forwarder; map< Connection, long long > lastCursor; map< Connection, map< long long, long long > > mapCursor; @@ -364,7 +363,7 @@ void processMessage( Connection& c , Message& m ) { if ( !forwardAddress.empty() ) { if ( m.operation() != mongo::opReply ) { - boost::shared_ptr<DBClientConnection> conn = forwarder[ c ]; + std::shared_ptr<DBClientConnection> conn = forwarder[ c ]; if ( !conn ) { conn.reset(new DBClientConnection( true )); conn->connect( forwardAddress ); diff --git a/src/mongo/unittest/unittest.cpp b/src/mongo/unittest/unittest.cpp index 477045a27d0..d4f0729ab67 100644 --- a/src/mongo/unittest/unittest.cpp +++ b/src/mongo/unittest/unittest.cpp @@ -32,7 +32,6 @@ #include "mongo/unittest/unittest.h" -#include <boost/shared_ptr.hpp> #include <iostream> #include <map> @@ -48,7 +47,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; namespace unittest { @@ -57,7 +56,7 @@ namespace mongo { logger::MessageLogDomain* unittestOutput = logger::globalLogManager()->getNamedDomain("unittest"); - typedef std::map<std::string, boost::shared_ptr<Suite> > SuiteMap; + typedef std::map<std::string, std::shared_ptr<Suite> > SuiteMap; inline SuiteMap& _allSuites() { static SuiteMap allSuites; @@ -193,7 +192,7 @@ namespace { Suite::~Suite() {} void Suite::add(const std::string& name, const TestFunction& testFn) { - _tests.push_back(boost::shared_ptr<TestHolder>(new TestHolder(name, testFn))); + _tests.push_back(std::shared_ptr<TestHolder>(new TestHolder(name, testFn))); } Result * Suite::run( const std::string& filter, int runsPerTest ) { @@ -206,9 +205,9 @@ namespace { Result * r = new Result( _name ); Result::cur = r; - for ( std::vector< boost::shared_ptr<TestHolder> >::iterator i=_tests.begin(); + for ( std::vector< std::shared_ptr<TestHolder> >::iterator i=_tests.begin(); i!=_tests.end(); i++ ) { - boost::shared_ptr<TestHolder>& tc = *i; + std::shared_ptr<TestHolder>& tc = *i; if ( filter.size() && tc->getName().find( filter ) == std::string::npos ) { LOG(1) << "\t skipping test: " << tc->getName() << " because doesn't match filter" << std::endl; continue; @@ -288,7 +287,7 @@ namespace { for ( std::vector<std::string>::iterator i=torun.begin(); i!=torun.end(); i++ ) { std::string name = *i; - boost::shared_ptr<Suite>& s = _allSuites()[name]; + std::shared_ptr<Suite>& s = _allSuites()[name]; fassert( 16145, s != NULL ); log() << "going to run suite: " << name << std::endl; @@ -353,13 +352,13 @@ namespace { } void Suite::registerSuite( const std::string& name , Suite* s ) { - boost::shared_ptr<Suite>& m = _allSuites()[name]; + std::shared_ptr<Suite>& m = _allSuites()[name]; fassert( 10162, !m ); m.reset(s); } Suite* Suite::getSuite(const std::string& name) { - boost::shared_ptr<Suite>& result = _allSuites()[name]; + std::shared_ptr<Suite>& result = _allSuites()[name]; if (!result) { // Suites are self-registering. new Suite(name); diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h index fad64609187..c44dd8ab41f 100644 --- a/src/mongo/unittest/unittest.h +++ b/src/mongo/unittest/unittest.h @@ -42,7 +42,6 @@ #include <boost/config.hpp> #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include "mongo/base/status_with.h" #include "mongo/logger/logstream_builder.h" @@ -382,7 +381,7 @@ namespace mongo { private: // TODO(C++11): Make this hold unique_ptrs. - typedef std::vector< boost::shared_ptr<TestHolder> > TestHolderList; + typedef std::vector< std::shared_ptr<TestHolder> > TestHolderList; template <typename T> static void runTestObject() { @@ -491,7 +490,7 @@ namespace mongo { TestAssertionFailure failure() { return *_assertion; } \ private: \ void comparison_failed() const {} \ - boost::shared_ptr<TestAssertionFailure> _assertion; \ + std::shared_ptr<TestAssertionFailure> _assertion; \ } DECLARE_COMPARISON_ASSERTION(EQ, ==); diff --git a/src/mongo/util/concurrency/task.h b/src/mongo/util/concurrency/task.h index 2b1ea26a1ce..e3430a6f9b4 100644 --- a/src/mongo/util/concurrency/task.h +++ b/src/mongo/util/concurrency/task.h @@ -74,7 +74,7 @@ namespace mongo { virtual void doWork() { result = 1234; } Sample() : result(0) { } }; - boost::shared_ptr<Sample> q( new Sample() ); + std::shared_ptr<Sample> q( new Sample() ); fork(q); cout << q->result << std::endl; // could print 1234 or 0. } diff --git a/src/mongo/util/embedded_builder.h b/src/mongo/util/embedded_builder.h index 068d80200c2..3ef84f427e0 100644 --- a/src/mongo/util/embedded_builder.h +++ b/src/mongo/util/embedded_builder.h @@ -29,7 +29,6 @@ #pragma once -#include <boost/shared_ptr.hpp> namespace mongo { @@ -86,7 +85,7 @@ namespace mongo { private: void addBuilder( const std::string &name ) { - boost::shared_ptr< BSONObjBuilder > newBuilder( new BSONObjBuilder( back()->subobjStart( name ) ) ); + std::shared_ptr< BSONObjBuilder > newBuilder( new BSONObjBuilder( back()->subobjStart( name ) ) ); _builders.push_back( std::make_pair( name, newBuilder.get() ) ); _builderStorage.push_back( newBuilder ); } @@ -99,7 +98,7 @@ namespace mongo { BSONObjBuilder *back() { return _builders.back().second; } std::vector< std::pair< std::string, BSONObjBuilder * > > _builders; - std::vector< boost::shared_ptr< BSONObjBuilder > > _builderStorage; + std::vector< std::shared_ptr< BSONObjBuilder > > _builderStorage; }; diff --git a/src/mongo/util/net/listen.cpp b/src/mongo/util/net/listen.cpp index 4cb97c9367e..1a7f0773588 100644 --- a/src/mongo/util/net/listen.cpp +++ b/src/mongo/util/net/listen.cpp @@ -34,7 +34,6 @@ #include "mongo/util/net/listen.h" -#include <boost/shared_ptr.hpp> #include "mongo/config.h" #include "mongo/db/server_options.h" @@ -75,7 +74,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::string; using std::vector; @@ -339,7 +338,7 @@ namespace mongo { log() << "connection accepted from " << from.toString() << " #" << myConnectionNumber << " (" << conns << word << " now open)" << endl; } - boost::shared_ptr<Socket> pnewSock( new Socket(s, from) ); + std::shared_ptr<Socket> pnewSock( new Socket(s, from) ); #ifdef MONGO_CONFIG_SSL if (_ssl) { pnewSock->secureAccepted(_ssl); @@ -556,7 +555,7 @@ namespace mongo { log() << "connection accepted from " << from.toString() << " #" << myConnectionNumber << " (" << conns << word << " now open)" << endl; } - boost::shared_ptr<Socket> pnewSock( new Socket(s, from) ); + std::shared_ptr<Socket> pnewSock( new Socket(s, from) ); #ifdef MONGO_CONFIG_SSL if (_ssl) { pnewSock->secureAccepted(_ssl); @@ -578,7 +577,7 @@ namespace mongo { } } - void Listener::accepted(boost::shared_ptr<Socket> psocket, long long connectionId ) { + void Listener::accepted(std::shared_ptr<Socket> psocket, long long connectionId ) { MessagingPort* port = new MessagingPort(psocket); port->setConnectionId( connectionId ); acceptedMP( port ); diff --git a/src/mongo/util/net/listen.h b/src/mongo/util/net/listen.h index f2b336c3a7e..2db88ffb141 100644 --- a/src/mongo/util/net/listen.h +++ b/src/mongo/util/net/listen.h @@ -30,7 +30,6 @@ #pragma once #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/condition_variable.hpp> #include <set> @@ -58,7 +57,7 @@ namespace mongo { void initAndListen(); // never returns unless error (start a thread) /* spawn a thread, etc., then return */ - virtual void accepted(boost::shared_ptr<Socket> psocket, long long connectionId ); + virtual void accepted(std::shared_ptr<Socket> psocket, long long connectionId ); virtual void acceptedMP(MessagingPort *mp); const int _port; diff --git a/src/mongo/util/net/message_port.cpp b/src/mongo/util/net/message_port.cpp index 3d7829d2300..be05fbd1aff 100644 --- a/src/mongo/util/net/message_port.cpp +++ b/src/mongo/util/net/message_port.cpp @@ -33,7 +33,6 @@ #include "mongo/util/net/message_port.h" -#include <boost/shared_ptr.hpp> #include <fcntl.h> #include <time.h> @@ -58,7 +57,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::string; // if you want trace output: @@ -154,7 +153,7 @@ namespace mongo { piggyBackData = 0; } - MessagingPort::MessagingPort( boost::shared_ptr<Socket> sock ) + MessagingPort::MessagingPort( std::shared_ptr<Socket> sock ) : psock( sock ), piggyBackData( 0 ) { ports.insert(this); } diff --git a/src/mongo/util/net/message_port.h b/src/mongo/util/net/message_port.h index 45f8eae4d62..161b30037af 100644 --- a/src/mongo/util/net/message_port.h +++ b/src/mongo/util/net/message_port.h @@ -30,7 +30,6 @@ #pragma once #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <vector> #include "mongo/config.h" @@ -86,7 +85,7 @@ namespace mongo { MessagingPort(double so_timeout = 0, logger::LogSeverity logLevel = logger::LogSeverity::Log() ); - MessagingPort(boost::shared_ptr<Socket> socket); + MessagingPort(std::shared_ptr<Socket> socket); virtual ~MessagingPort(); @@ -122,7 +121,7 @@ namespace mongo { virtual SockAddr remoteAddr() const; virtual SockAddr localAddr() const; - boost::shared_ptr<Socket> psock; + std::shared_ptr<Socket> psock; void send( const char * data , int len, const char *context ) { psock->send( data, len, context ); diff --git a/src/mongo/util/net/message_server_port.cpp b/src/mongo/util/net/message_server_port.cpp index e8df178e2af..f6e5f95a44e 100644 --- a/src/mongo/util/net/message_server_port.cpp +++ b/src/mongo/util/net/message_server_port.cpp @@ -73,7 +73,7 @@ namespace { MONGO_DISALLOW_COPYING(MessagingPortWithHandler); public: - MessagingPortWithHandler(const boost::shared_ptr<Socket>& socket, + MessagingPortWithHandler(const std::shared_ptr<Socket>& socket, MessageHandler* handler, long long connectionId) : MessagingPort(socket), _handler(handler) { @@ -102,7 +102,7 @@ namespace { Listener( "" , opts.ipList, opts.port ), _handler(handler) { } - virtual void accepted(boost::shared_ptr<Socket> psocket, long long connectionId ) { + virtual void accepted(std::shared_ptr<Socket> psocket, long long connectionId ) { ScopeGuard sleepAfterClosingPort = MakeGuard(sleepmillis, 2); std::unique_ptr<MessagingPortWithHandler> portWithHandler( new MessagingPortWithHandler(psocket, _handler, connectionId)); diff --git a/src/mongo/util/net/miniwebserver.cpp b/src/mongo/util/net/miniwebserver.cpp index 2dbf68b6d6f..888ca70e4de 100644 --- a/src/mongo/util/net/miniwebserver.cpp +++ b/src/mongo/util/net/miniwebserver.cpp @@ -33,7 +33,6 @@ #include "mongo/util/net/miniwebserver.h" -#include <boost/shared_ptr.hpp> #include <pcrecpp.h> #include "mongo/config.h" @@ -42,7 +41,7 @@ namespace mongo { - using boost::shared_ptr; + using std::shared_ptr; using std::endl; using std::stringstream; using std::vector; @@ -132,7 +131,7 @@ namespace mongo { return false; } - void MiniWebServer::accepted(boost::shared_ptr<Socket> psock, long long connectionId ) { + void MiniWebServer::accepted(std::shared_ptr<Socket> psock, long long connectionId ) { char buf[4096]; int len = 0; try { diff --git a/src/mongo/util/net/miniwebserver.h b/src/mongo/util/net/miniwebserver.h index 6ae82f90966..d0eb06f445a 100644 --- a/src/mongo/util/net/miniwebserver.h +++ b/src/mongo/util/net/miniwebserver.h @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" -#include <boost/shared_ptr.hpp> #include "mongo/db/jsobj.h" #include "mongo/util/net/listen.h" @@ -68,7 +67,7 @@ namespace mongo { static std::string urlDecode(const std::string& s) {return urlDecode(s.c_str());} private: - void accepted(boost::shared_ptr<Socket> psocket, long long connectionId ); + void accepted(std::shared_ptr<Socket> psocket, long long connectionId ); static bool fullReceive( const char *buf ); }; diff --git a/src/mongo/util/net/sock_test.cpp b/src/mongo/util/net/sock_test.cpp index 3b6a6a07638..dbc42903915 100644 --- a/src/mongo/util/net/sock_test.cpp +++ b/src/mongo/util/net/sock_test.cpp @@ -30,7 +30,6 @@ #include "mongo/util/net/sock.h" -#include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #ifndef _WIN32 @@ -47,9 +46,9 @@ namespace { using namespace mongo; - using boost::shared_ptr; + using std::shared_ptr; - typedef boost::shared_ptr<Socket> SocketPtr; + typedef std::shared_ptr<Socket> SocketPtr; typedef std::pair<SocketPtr, SocketPtr> SocketPair; // On UNIX, make a connected pair of PF_LOCAL (aka PF_UNIX) sockets via the native 'socketpair' diff --git a/src/mongo/util/options_parser/environment.cpp b/src/mongo/util/options_parser/environment.cpp index 432c8735e1d..2aa768f6f07 100644 --- a/src/mongo/util/options_parser/environment.cpp +++ b/src/mongo/util/options_parser/environment.cpp @@ -27,7 +27,6 @@ #include "mongo/util/options_parser/environment.h" -#include <boost/shared_ptr.hpp> #include <iostream> #include "mongo/bson/util/builder.h" @@ -37,7 +36,7 @@ namespace mongo { namespace optionenvironment { - using boost::shared_ptr; + using std::shared_ptr; using std::string; using std::type_info; diff --git a/src/mongo/util/options_parser/environment.h b/src/mongo/util/options_parser/environment.h index 8c44eb661d1..507ee4f7592 100644 --- a/src/mongo/util/options_parser/environment.h +++ b/src/mongo/util/options_parser/environment.h @@ -27,7 +27,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <map> #include <vector> diff --git a/src/mongo/util/options_parser/option_description.cpp b/src/mongo/util/options_parser/option_description.cpp index c903a3ddce0..ebef43be3cf 100644 --- a/src/mongo/util/options_parser/option_description.cpp +++ b/src/mongo/util/options_parser/option_description.cpp @@ -28,14 +28,13 @@ #include "mongo/util/options_parser/option_description.h" #include <algorithm> -#include <boost/shared_ptr.hpp> #include "mongo/util/assert_util.h" namespace mongo { namespace optionenvironment { - using boost::shared_ptr; + using std::shared_ptr; namespace { /** @@ -284,7 +283,7 @@ namespace optionenvironment { } OptionDescription& OptionDescription::addConstraint(Constraint* c) { - _constraints.push_back(boost::shared_ptr<Constraint>(c)); + _constraints.push_back(std::shared_ptr<Constraint>(c)); return *this; } diff --git a/src/mongo/util/options_parser/option_description.h b/src/mongo/util/options_parser/option_description.h index 5bfe83c3a30..b126df402f6 100644 --- a/src/mongo/util/options_parser/option_description.h +++ b/src/mongo/util/options_parser/option_description.h @@ -27,7 +27,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <vector> #include "mongo/base/status.h" @@ -225,7 +224,7 @@ namespace optionenvironment { // these classes. Note that the Environment (the storage for results of option parsing) has // to know about the constraints for all the options, which is another factor to consider // when thinking about ownership. - std::vector<boost::shared_ptr<Constraint> > _constraints; // Constraints that must be met + std::vector<std::shared_ptr<Constraint> > _constraints; // Constraints that must be met // for this option to be valid // Deprecated dotted names - aliases for '_dottedName'. diff --git a/src/mongo/util/options_parser/option_section.cpp b/src/mongo/util/options_parser/option_section.cpp index 5d3646554ee..c996f615ba4 100644 --- a/src/mongo/util/options_parser/option_section.cpp +++ b/src/mongo/util/options_parser/option_section.cpp @@ -28,7 +28,6 @@ #include "mongo/util/options_parser/option_section.h" #include <algorithm> -#include <boost/shared_ptr.hpp> #include <iostream> #include <sstream> @@ -39,7 +38,7 @@ namespace mongo { namespace optionenvironment { - using boost::shared_ptr; + using std::shared_ptr; // Registration interface @@ -544,11 +543,11 @@ namespace optionenvironment { } Status OptionSection::getConstraints( - std::vector<boost::shared_ptr<Constraint > >* constraints) const { + std::vector<std::shared_ptr<Constraint > >* constraints) const { std::list<OptionDescription>::const_iterator oditerator; for (oditerator = _options.begin(); oditerator != _options.end(); oditerator++) { - std::vector<boost::shared_ptr<Constraint> >::const_iterator citerator; + std::vector<std::shared_ptr<Constraint> >::const_iterator citerator; for (citerator = oditerator->_constraints.begin(); citerator != oditerator->_constraints.end(); citerator++) { constraints->push_back(*citerator); diff --git a/src/mongo/util/options_parser/option_section.h b/src/mongo/util/options_parser/option_section.h index 572e2b60e0d..1cfe5668170 100644 --- a/src/mongo/util/options_parser/option_section.h +++ b/src/mongo/util/options_parser/option_section.h @@ -29,7 +29,6 @@ #include "mongo/util/options_parser/option_description.h" #include <boost/program_options.hpp> -#include <boost/shared_ptr.hpp> #include <list> #include "mongo/base/status.h" @@ -155,7 +154,7 @@ namespace optionenvironment { * Populates the given vector with all the constraints for all options in this section and * sub sections. */ - Status getConstraints(std::vector<boost::shared_ptr<Constraint > >* constraints) const; + Status getConstraints(std::vector<std::shared_ptr<Constraint > >* constraints) const; std::string positionalHelpString(const std::string& execName) const; std::string helpString() const; diff --git a/src/mongo/util/options_parser/options_parser.cpp b/src/mongo/util/options_parser/options_parser.cpp index e4d4817f546..eebd7d83e2c 100644 --- a/src/mongo/util/options_parser/options_parser.cpp +++ b/src/mongo/util/options_parser/options_parser.cpp @@ -30,7 +30,6 @@ #include "mongo/util/options_parser/options_parser.h" #include <boost/program_options.hpp> -#include <boost/shared_ptr.hpp> #include <algorithm> #include <cerrno> #include <fstream> @@ -53,7 +52,7 @@ namespace mongo { namespace optionenvironment { using namespace std; - using boost::shared_ptr; + using std::shared_ptr; namespace po = boost::program_options; @@ -606,14 +605,14 @@ namespace optionenvironment { * they run when the environment gets validated. */ Status addConstraints(const OptionSection& options, Environment* dest) { - std::vector<boost::shared_ptr<Constraint> > constraints_vector; + std::vector<std::shared_ptr<Constraint> > constraints_vector; Status ret = options.getConstraints(&constraints_vector); if (!ret.isOK()) { return ret; } - std::vector<boost::shared_ptr<Constraint> >::const_iterator citerator; + std::vector<std::shared_ptr<Constraint> >::const_iterator citerator; for (citerator = constraints_vector.begin(); citerator != constraints_vector.end(); citerator++) { dest->addConstraint(citerator->get()); diff --git a/src/mongo/util/unowned_ptr.h b/src/mongo/util/unowned_ptr.h index 7bc66dda59b..b2053d13da3 100644 --- a/src/mongo/util/unowned_ptr.h +++ b/src/mongo/util/unowned_ptr.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <boost/static_assert.hpp> #include <memory> #include <type_traits> @@ -71,9 +70,6 @@ namespace mongo { template<typename U, typename = IfConvertibleFrom<U>> unowned_ptr(const std::shared_ptr<U>& p) : _p(p.get()) {} - template<typename U, typename = IfConvertibleFrom<U>> - unowned_ptr(const boost::shared_ptr<U>& p) : _p(p.get()) {} - // // Modifiers // diff --git a/src/mongo/util/unowned_ptr_test.cpp b/src/mongo/util/unowned_ptr_test.cpp index 058480e3936..5ad5366b7dc 100644 --- a/src/mongo/util/unowned_ptr_test.cpp +++ b/src/mongo/util/unowned_ptr_test.cpp @@ -40,7 +40,7 @@ namespace mongo { std::unique_ptr<int> p1(new int(1)); std::shared_ptr<int> p2(new int(2)); std::unique_ptr<int> p3(new int(3)); - boost::shared_ptr<int> p4(new int(4)); + std::shared_ptr<int> p4(new int(4)); ASSERT_EQUALS(aNullPtr, unowned_ptr<int>()); ASSERT_EQUALS(aNullPtr, unowned_ptr<int>({})); @@ -53,7 +53,7 @@ namespace mongo { //const std::unique_ptr<const int> cp1(new int(11)); - boost::shared_ptr<const int> cp2(new int(12)); + std::shared_ptr<const int> cp2(new int(12)); ASSERT_EQUALS(aNullPtr, unowned_ptr<const int>()); ASSERT_EQUALS(aNullPtr, unowned_ptr<const int>({})); @@ -81,7 +81,7 @@ namespace mongo { std::unique_ptr<int> p1(new int(1)); std::shared_ptr<int> p2(new int(2)); std::unique_ptr<int> p3(new int(3)); - boost::shared_ptr<int> p4(new int(4)); + std::shared_ptr<int> p4(new int(4)); ASSERT_EQUALS(aNullPtr, (unowned_ptr<int>() = {})); ASSERT_EQUALS(aNullPtr, (unowned_ptr<int>() = nullptr)); @@ -93,7 +93,7 @@ namespace mongo { //const std::unique_ptr<const int> cp1(new int(11)); - boost::shared_ptr<const int> cp2(new int(12)); + std::shared_ptr<const int> cp2(new int(12)); ASSERT_EQUALS(aNullPtr, (unowned_ptr<const int>() = {})); ASSERT_EQUALS(aNullPtr, (unowned_ptr<const int>() = nullptr)); |