diff options
Diffstat (limited to 'src/mongo/client')
-rw-r--r-- | src/mongo/client/connection_pool.cpp | 2 | ||||
-rw-r--r-- | src/mongo/client/dbclient.cpp | 30 | ||||
-rw-r--r-- | src/mongo/client/dbclient_rs.cpp | 12 | ||||
-rw-r--r-- | src/mongo/client/dbclient_rs.h | 6 | ||||
-rw-r--r-- | src/mongo/client/dbclient_rs_test.cpp | 44 | ||||
-rw-r--r-- | src/mongo/client/dbclientcursor.cpp | 12 | ||||
-rw-r--r-- | src/mongo/client/dbclientcursor.h | 2 | ||||
-rw-r--r-- | src/mongo/client/dbclientinterface.h | 10 | ||||
-rw-r--r-- | src/mongo/client/parallel.h | 4 | ||||
-rw-r--r-- | src/mongo/client/sasl_sspi.cpp | 2 | ||||
-rw-r--r-- | src/mongo/client/syncclusterconnection.cpp | 14 | ||||
-rw-r--r-- | src/mongo/client/syncclusterconnection.h | 10 |
12 files changed, 74 insertions, 74 deletions
diff --git a/src/mongo/client/connection_pool.cpp b/src/mongo/client/connection_pool.cpp index ed994b25c33..b7ebda533aa 100644 --- a/src/mongo/client/connection_pool.cpp +++ b/src/mongo/client/connection_pool.cpp @@ -169,7 +169,7 @@ namespace { // No idle connection in the pool; make a new one. lk.unlock(); - std::auto_ptr<DBClientConnection> conn(new DBClientConnection); + std::unique_ptr<DBClientConnection> conn(new DBClientConnection); // setSoTimeout takes a double representing the number of seconds for send and receive // timeouts. Thus, we must take count() and divide by 1000.0 to get the number diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp index cee1c7c92ea..aa7a6e73032 100644 --- a/src/mongo/client/dbclient.cpp +++ b/src/mongo/client/dbclient.cpp @@ -62,7 +62,7 @@ namespace mongo { - using std::auto_ptr; + using std::unique_ptr; using std::endl; using std::list; using std::map; @@ -795,7 +795,7 @@ namespace { if ( id != 0 ) { const std::string ns = cursorObj["ns"].String(); - auto_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0); + unique_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0); while ( cursor->more() ) { infos.push_back(cursor->nextSafe().getOwned()); } @@ -826,7 +826,7 @@ namespace { fallbackFilter.appendElementsUnique( filter ); string ns = db + ".system.namespaces"; - auto_ptr<DBClientCursor> c = query( + unique_ptr<DBClientCursor> c = query( ns.c_str(), fallbackFilter.obj(), 0, 0, 0, QueryOption_SlaveOk); uassert(28611, str::stream() << "listCollections failed querying " << ns, c.get()); @@ -870,7 +870,7 @@ namespace { void DBClientInterface::findN(vector<BSONObj>& out, const string& ns, Query query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions) { out.reserve(nToReturn); - auto_ptr<DBClientCursor> c = + unique_ptr<DBClientCursor> c = this->query(ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions); uassert( 10276 , str::stream() << "DBClientBase::findN: transport error: " << getServerAddress() << " ns: " << ns << " query: " << query.toString(), c.get() ); @@ -906,7 +906,7 @@ namespace { // we keep around SockAddr for connection life -- maybe MessagingPort // requires that? - std::auto_ptr<SockAddr> serverSockAddr(new SockAddr(_server.host().c_str(), + std::unique_ptr<SockAddr> serverSockAddr(new SockAddr(_server.host().c_str(), _server.port())); if (!serverSockAddr->isValid()) { errmsg = str::stream() << "couldn't initialize connection to host " @@ -1024,21 +1024,21 @@ namespace { const uint64_t DBClientBase::INVALID_SOCK_CREATION_TIME = static_cast<uint64_t>(0xFFFFFFFFFFFFFFFFULL); - auto_ptr<DBClientCursor> DBClientBase::query(const string &ns, Query query, int nToReturn, + unique_ptr<DBClientCursor> DBClientBase::query(const string &ns, Query query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions , int batchSize ) { - auto_ptr<DBClientCursor> c( new DBClientCursor( this, + unique_ptr<DBClientCursor> c( new DBClientCursor( this, ns, query.obj, nToReturn, nToSkip, fieldsToReturn, queryOptions , batchSize ) ); if ( c->init() ) return c; - return auto_ptr< DBClientCursor >( 0 ); + return nullptr; } - auto_ptr<DBClientCursor> DBClientBase::getMore( const string &ns, long long cursorId, int nToReturn, int options ) { - auto_ptr<DBClientCursor> c( new DBClientCursor( this, ns, cursorId, nToReturn, options ) ); + unique_ptr<DBClientCursor> DBClientBase::getMore( const string &ns, long long cursorId, int nToReturn, int options ) { + unique_ptr<DBClientCursor> c( new DBClientCursor( this, ns, cursorId, nToReturn, options ) ); if ( c->init() ) return c; - return auto_ptr< DBClientCursor >( 0 ); + return nullptr; } struct DBClientFunConvertor { @@ -1067,7 +1067,7 @@ namespace { // mask options queryOptions &= (int)( QueryOption_NoCursorTimeout | QueryOption_SlaveOk ); - auto_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) ); + unique_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) ); uassert( 16090, "socket error for mapping query", c.get() ); unsigned long long n = 0; @@ -1095,7 +1095,7 @@ namespace { queryOptions &= (int)( QueryOption_NoCursorTimeout | QueryOption_SlaveOk ); queryOptions |= (int)QueryOption_Exhaust; - auto_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) ); + unique_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) ); uassert( 13386, "socket error for mapping query", c.get() ); unsigned long long n = 0; @@ -1250,7 +1250,7 @@ namespace { if ( id != 0 ) { const std::string ns = cursorObj["ns"].String(); - auto_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0); + unique_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0); while ( cursor->more() ) { specs.push_back(cursor->nextSafe().getOwned()); } @@ -1274,7 +1274,7 @@ namespace { // fallback to querying system.indexes // TODO(spencer): Remove fallback behavior after 3.0 - auto_ptr<DBClientCursor> cursor = query(NamespaceString(ns).getSystemIndexesCollection(), + unique_ptr<DBClientCursor> cursor = query(NamespaceString(ns).getSystemIndexesCollection(), BSON("ns" << ns), 0, 0, 0, options); uassert(28612, str::stream() << "listIndexes failed querying " << ns, cursor.get()); diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp index 07884da5313..a344f8d3fb8 100644 --- a/src/mongo/client/dbclient_rs.cpp +++ b/src/mongo/client/dbclient_rs.cpp @@ -47,7 +47,7 @@ namespace mongo { using boost::shared_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::endl; using std::map; using std::set; @@ -261,7 +261,7 @@ namespace { bool DBClientReplicaSet::isSecondaryQuery( const string& ns, const BSONObj& queryObj, int queryOptions ) { - auto_ptr<ReadPreferenceSetting> readPref( _extractReadPref( queryObj, queryOptions ) ); + unique_ptr<ReadPreferenceSetting> readPref( _extractReadPref( queryObj, queryOptions ) ); return _isSecondaryQuery( ns, queryObj, *readPref ); } @@ -491,7 +491,7 @@ namespace { return checkMaster()->update( ns, query, obj, flags ); } - auto_ptr<DBClientCursor> DBClientReplicaSet::query(const string &ns, + unique_ptr<DBClientCursor> DBClientReplicaSet::query(const string &ns, Query query, int nToReturn, int nToSkip, @@ -521,11 +521,11 @@ namespace { break; } - auto_ptr<DBClientCursor> cursor = conn->query(ns, query, + unique_ptr<DBClientCursor> cursor = conn->query(ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize); - return checkSlaveQueryResult(cursor); + return checkSlaveQueryResult(std::move(cursor)); } catch (const DBException &dbExcep) { StringBuilder errMsgBuilder; @@ -629,7 +629,7 @@ namespace { resetMaster(); } - auto_ptr<DBClientCursor> DBClientReplicaSet::checkSlaveQueryResult( auto_ptr<DBClientCursor> result ){ + unique_ptr<DBClientCursor> DBClientReplicaSet::checkSlaveQueryResult( unique_ptr<DBClientCursor> result ){ if ( result.get() == NULL ) return result; BSONObj error; diff --git a/src/mongo/client/dbclient_rs.h b/src/mongo/client/dbclient_rs.h index 8b85e1664c2..ac32ccd4964 100644 --- a/src/mongo/client/dbclient_rs.h +++ b/src/mongo/client/dbclient_rs.h @@ -80,7 +80,7 @@ namespace mongo { // ----------- simple functions -------------- /** throws userassertion "no master found" */ - virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0, + virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ); /** throws userassertion "no master found" */ @@ -207,7 +207,7 @@ namespace mongo { * @throws DBException if the directed node cannot accept the query because it * is not a master */ - std::auto_ptr<DBClientCursor> checkSlaveQueryResult( std::auto_ptr<DBClientCursor> result ); + std::unique_ptr<DBClientCursor> checkSlaveQueryResult( std::unique_ptr<DBClientCursor> result ); DBClientConnection * checkMaster(); @@ -277,7 +277,7 @@ namespace mongo { // Connection can either be owned here or returned to the connection pool. Note that // if connection is primary, it is owned by _master so it is incorrect to return // it to the pool. - std::auto_ptr<DBClientConnection> _lastSlaveOkConn; + std::unique_ptr<DBClientConnection> _lastSlaveOkConn; boost::shared_ptr<ReadPreferenceSetting> _lastReadPref; double _so_timeout; diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp index 03dce3cb711..34abf413d5b 100644 --- a/src/mongo/client/dbclient_rs_test.cpp +++ b/src/mongo/client/dbclient_rs_test.cpp @@ -49,7 +49,7 @@ namespace { using boost::scoped_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::map; using std::make_pair; using std::pair; @@ -109,7 +109,7 @@ namespace { query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -122,7 +122,7 @@ namespace { query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -138,7 +138,7 @@ namespace { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -154,7 +154,7 @@ namespace { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -282,7 +282,7 @@ namespace { query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -295,7 +295,7 @@ namespace { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -308,7 +308,7 @@ namespace { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -319,7 +319,7 @@ namespace { Query query; query.readPref(mongo::ReadPreference::Nearest, BSONArray()); - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str()); } @@ -361,7 +361,7 @@ namespace { query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -383,7 +383,7 @@ namespace { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -396,7 +396,7 @@ namespace { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -409,7 +409,7 @@ namespace { query.readPref(mongo::ReadPreference::Nearest, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str()); } @@ -544,7 +544,7 @@ namespace { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); } @@ -552,7 +552,7 @@ namespace { { Query query; query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_EQUALS(dest, newDest); @@ -572,7 +572,7 @@ namespace { query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); } @@ -585,7 +585,7 @@ namespace { { Query query; query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray()); - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, newDest); @@ -608,7 +608,7 @@ namespace { query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray()); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, replSet->getPrimary()); @@ -617,7 +617,7 @@ namespace { { Query query; query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray()); - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, newDest); @@ -641,7 +641,7 @@ namespace { BSON_ARRAY(BSON("dc" << "sf"))); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, replSet->getPrimary()); @@ -652,7 +652,7 @@ namespace { vector<pair<string, string> > tagSet; query.readPref(mongo::ReadPreference::SecondaryPreferred, BSON_ARRAY(BSON("group" << 1))); - auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); + unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query); BSONObj doc = cursor->next(); const string newDest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, newDest); @@ -675,7 +675,7 @@ namespace { mongo::DBClientConnection& secConn = replConn.slaveConn(); // Note: IdentityNS contains the name of the server. - auto_ptr<DBClientCursor> cursor = secConn.query(IdentityNS, Query()); + unique_ptr<DBClientCursor> cursor = secConn.query(IdentityNS, Query()); BSONObj doc = cursor->next(); dest = doc[HostField.name()].str(); ASSERT_NOT_EQUALS(dest, replSet->getPrimary()); diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclientcursor.cpp index 94ed23d18d7..f0f4a5de653 100644 --- a/src/mongo/client/dbclientcursor.cpp +++ b/src/mongo/client/dbclientcursor.cpp @@ -43,7 +43,7 @@ namespace mongo { - using std::auto_ptr; + using std::unique_ptr; using std::endl; using std::string; using std::vector; @@ -168,11 +168,11 @@ namespace mongo { Message toSend; toSend.setData(dbGetMore, b.buf(), b.len()); - auto_ptr<Message> response(new Message()); + unique_ptr<Message> response(new Message()); if ( _client ) { _client->call( toSend, *response ); - this->batch.m = response; + this->batch.m = std::move(response); dataReceived(); } else { @@ -180,7 +180,7 @@ namespace mongo { ScopedDbConnection conn(_scopedHost); conn->call( toSend , *response ); _client = conn.get(); - this->batch.m = response; + this->batch.m = std::move(response); dataReceived(); _client = 0; conn.done(); @@ -191,12 +191,12 @@ namespace mongo { void DBClientCursor::exhaustReceiveMore() { verify( cursorId && batch.pos == batch.nReturned ); verify( !haveLimit ); - auto_ptr<Message> response(new Message()); + unique_ptr<Message> response(new Message()); verify( _client ); if (!_client->recv(*response)) { uasserted(16465, "recv failed while exhausting cursor"); } - batch.m = response; + batch.m = std::move(response); dataReceived(); } diff --git a/src/mongo/client/dbclientcursor.h b/src/mongo/client/dbclientcursor.h index 53bce3056dc..ae6fc33dfd6 100644 --- a/src/mongo/client/dbclientcursor.h +++ b/src/mongo/client/dbclientcursor.h @@ -206,7 +206,7 @@ namespace mongo { class Batch : boost::noncopyable { friend class DBClientCursor; - std::auto_ptr<Message> m; + std::unique_ptr<Message> m; int nReturned; int pos; const char *data; diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h index e0361156d1d..0aae9081a13 100644 --- a/src/mongo/client/dbclientinterface.h +++ b/src/mongo/client/dbclientinterface.h @@ -373,7 +373,7 @@ namespace mongo { */ class DBClientInterface : boost::noncopyable { public: - virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0, + virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ) = 0; virtual void insert( const std::string &ns, BSONObj obj , int flags=0) = 0; @@ -407,7 +407,7 @@ namespace mongo { virtual std::string getServerAddress() const = 0; /** don't use this - called automatically by DBClientCursor for you */ - virtual std::auto_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 ) = 0; + virtual std::unique_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 ) = 0; }; /** @@ -900,7 +900,7 @@ namespace mongo { @return cursor. 0 if error (connection failure) @throws AssertionException */ - virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0, + virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ); @@ -930,7 +930,7 @@ namespace mongo { @return an handle to a previously allocated cursor @throws AssertionException */ - virtual std::auto_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 ); + virtual std::unique_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 ); /** insert an object into the database @@ -1041,7 +1041,7 @@ namespace mongo { */ virtual void logout(const std::string& dbname, BSONObj& info); - virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query=Query(), int nToReturn = 0, int nToSkip = 0, + virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query=Query(), int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ) { checkConnection(); return DBClientBase::query( ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions , batchSize ); diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h index 241e591a166..d530dc88a04 100644 --- a/src/mongo/client/parallel.h +++ b/src/mongo/client/parallel.h @@ -284,8 +284,8 @@ namespace mongo { private: - std::auto_ptr<DBClientCursor> _cursor; - std::auto_ptr<ParallelConnectionMetadata> _pcmData; + std::unique_ptr<DBClientCursor> _cursor; + std::unique_ptr<ParallelConnectionMetadata> _pcmData; }; /** diff --git a/src/mongo/client/sasl_sspi.cpp b/src/mongo/client/sasl_sspi.cpp index af56a69c460..391530e20eb 100644 --- a/src/mongo/client/sasl_sspi.cpp +++ b/src/mongo/client/sasl_sspi.cpp @@ -182,7 +182,7 @@ namespace { } // Actually acquire the handle to the client credentials. - std::auto_ptr<SspiConnContext> pcctx(new SspiConnContext()); + std::unique_ptr<SspiConnContext> pcctx(new SspiConnContext()); pcctx->userPlusRealm = userPlusRealm; TimeStamp ignored; SECURITY_STATUS status = AcquireCredentialsHandleW(NULL, // principal diff --git a/src/mongo/client/syncclusterconnection.cpp b/src/mongo/client/syncclusterconnection.cpp index 79ed1abab23..792cd530e22 100644 --- a/src/mongo/client/syncclusterconnection.cpp +++ b/src/mongo/client/syncclusterconnection.cpp @@ -44,7 +44,7 @@ namespace mongo { - using std::auto_ptr; + using std::unique_ptr; using std::endl; using std::list; using std::map; @@ -323,7 +323,7 @@ namespace mongo { // TODO: logout is required for use of this class outside of a cluster environment - auto_ptr<DBClientCursor> SyncClusterConnection::query(const string &ns, Query query, int nToReturn, int nToSkip, + unique_ptr<DBClientCursor> SyncClusterConnection::query(const string &ns, Query query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions, int batchSize ) { _lastErrors.clear(); if ( ns.find( ".$cmd" ) != string::npos ) { @@ -336,7 +336,7 @@ namespace mongo { } bool SyncClusterConnection::_commandOnActive(const string &dbname, const BSONObj& cmd, BSONObj &info, int options ) { - auto_ptr<DBClientCursor> cursor = _queryOnActive(dbname + ".$cmd", cmd, 1, 0, 0, options, 0); + unique_ptr<DBClientCursor> cursor = _queryOnActive(dbname + ".$cmd", cmd, 1, 0, 0, options, 0); if ( cursor->more() ) info = cursor->next().copy(); else @@ -348,7 +348,7 @@ namespace mongo { _customQueryHandler.reset( handler ); } - auto_ptr<DBClientCursor> SyncClusterConnection::_queryOnActive(const string &ns, Query query, int nToReturn, int nToSkip, + unique_ptr<DBClientCursor> SyncClusterConnection::_queryOnActive(const string &ns, Query query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions, int batchSize ) { if ( _customQueryHandler && _customQueryHandler->canHandleQuery( ns, query ) ) { @@ -368,7 +368,7 @@ namespace mongo { for ( size_t i=0; i<_conns.size(); i++ ) { try { - auto_ptr<DBClientCursor> cursor = + unique_ptr<DBClientCursor> cursor = _conns[i]->query( ns , query , nToReturn , nToSkip , fieldsToReturn , queryOptions , batchSize ); if ( cursor.get() ) return cursor; @@ -390,9 +390,9 @@ namespace mongo { throw UserException( 8002 , str::stream() << "all servers down/unreachable when querying: " << _address ); } - auto_ptr<DBClientCursor> SyncClusterConnection::getMore( const string &ns, long long cursorId, int nToReturn, int options ) { + unique_ptr<DBClientCursor> SyncClusterConnection::getMore( const string &ns, long long cursorId, int nToReturn, int options ) { uassert( 10022 , "SyncClusterConnection::getMore not supported yet" , 0); - auto_ptr<DBClientCursor> c; + unique_ptr<DBClientCursor> c; return c; } diff --git a/src/mongo/client/syncclusterconnection.h b/src/mongo/client/syncclusterconnection.h index 3e662bac845..b47d4cfe0eb 100644 --- a/src/mongo/client/syncclusterconnection.h +++ b/src/mongo/client/syncclusterconnection.h @@ -82,10 +82,10 @@ namespace mongo { virtual BSONObj findOne(const std::string &ns, const Query& query, const BSONObj *fieldsToReturn, int queryOptions); - virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn, int nToSkip, + virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions, int batchSize ); - virtual std::auto_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn, int options ); + virtual std::unique_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn, int options ); virtual void insert( const std::string &ns, BSONObj obj, int flags=0); @@ -149,7 +149,7 @@ namespace mongo { SyncClusterConnection( SyncClusterConnection& prev, double socketTimeout = 0 ); std::string _toString() const; bool _commandOnActive(const std::string &dbname, const BSONObj& cmd, BSONObj &info, int options=0); - std::auto_ptr<DBClientCursor> _queryOnActive(const std::string &ns, Query query, int nToReturn, int nToSkip, + std::unique_ptr<DBClientCursor> _queryOnActive(const std::string &ns, Query query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions, int batchSize ); int _lockType( const std::string& name ); void _checkLast(); @@ -187,9 +187,9 @@ namespace mongo { /** * Returns a cursor on one of the hosts with the desired results for the query. - * May throw or return an empty auto_ptr on failure. + * May throw or return an empty unique_ptr on failure. */ - virtual std::auto_ptr<DBClientCursor> handleQuery( const std::vector<std::string>& hosts, + virtual std::unique_ptr<DBClientCursor> handleQuery( const std::vector<std::string>& hosts, const std::string &ns, Query query, int nToReturn, |