std::unique_ptr<OplogInterface::Iterator> OplogInterfaceRemote::makeIterator() const { const Query query = Query().sort(BSON("$natural" << -1)); const BSONObj fields = BSON("ts" << 1 << "t" << 1); return std::unique_ptr<OplogInterface::Iterator>( new OplogIteratorRemote(_getConnection()->query( NamespaceString(_collectionName), query, 0, 0, &fields, 0, _batchSize))); }
// connection request comming // generate an RyConnection // and use handle identify it. // // when new connection come and has the same handle. // reuse old RyConnection void RyProxyServer::incomingConnection(int handle){ //qDebug()<<"incomingConnection"; if(isStoping){ qDebug()<<"incommingConnection "<<isStoping; return; } RyConnection* connection = _getConnection(handle); Q_UNUSED(connection) }
StatusWith<BSONObj> RollbackSourceImpl::getCollectionInfo(const NamespaceString& nss) const { std::list<BSONObj> info = _getConnection()->getCollectionInfos(nss.db().toString(), BSON("name" << nss.coll())); if (info.empty()) { return StatusWith<BSONObj>(ErrorCodes::NoSuchKey, str::stream() << "no collection info found: " << nss.ns()); } invariant(info.size() == 1U); return info.front(); }
StatusWith<BSONObj> RollbackSourceImpl::getCollectionInfoByUUID(const std::string& db, const UUID& uuid) const { std::list<BSONObj> info = _getConnection()->getCollectionInfos(db, BSON("info.uuid" << uuid)); if (info.empty()) { return StatusWith<BSONObj>(ErrorCodes::NoSuchKey, str::stream() << "No collection info found for collection with uuid: " << uuid.toString() << " in db: " << db); } invariant(info.size() == 1U); return info.front(); }
std::string OplogInterfaceRemote::toString() const { return _getConnection()->toString(); }
CustomOCommand Node::send( const uint128_t& commandID, const bool multicast ) { ConnectionPtr connection = _getConnection( multicast ); LBASSERT( connection ); return CustomOCommand( Connections( 1, connection ), commandID ); }
OCommand Node::send( const uint32_t cmd, const bool multicast ) { ConnectionPtr connection = _getConnection( multicast ); LBASSERT( connection ); return OCommand( Connections( 1, connection ), cmd, COMMANDTYPE_NODE ); }
BSONObj RollbackSourceImpl::findOneByUUID(const std::string& db, UUID uuid, const BSONObj& filter) const { return _getConnection()->findOneByUUID(db, uuid, filter); }
BSONObj RollbackSourceImpl::findOne(const NamespaceString& nss, const BSONObj& filter) const { return _getConnection()->findOne(nss.toString(), filter, NULL, QueryOption_SlaveOk).getOwned(); }
BSONObj RollbackSourceImpl::getLastOperation() const { const Query query = Query().sort(BSON("$natural" << -1)); return _getConnection()->findOne(_collectionName, query, 0, QueryOption_SlaveOk); }
int RollbackSourceImpl::getRollbackId() const { bo info; _getConnection()->simpleCommand("admin", &info, "replSetGetRBID"); return info["rbid"].numberInt(); }