OID WriteBackManager::queueWriteBack( const string& remote , BSONObjBuilder& b ) { static mongo::mutex writebackIDOrdering( "WriteBackManager::queueWriteBack id ordering" ); scoped_lock lk( writebackIDOrdering ); OID writebackID; writebackID.initSequential(); b.append( "id", writebackID ); getWritebackQueue( remote )->queue.push( b.obj() ); return writebackID; }
bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool){ BSONElement e = cmdObj.firstElement(); if ( e.type() != jstOID ){ errmsg = "need oid as first value"; return 0; } const OID id = e.__oid(); BSONObj z = getWritebackQueue(id.str())->blockingPop(); log(1) << "WriteBackCommand got : " << z << endl; result.append( "data" , z ); return true; }
void WriteBackManager::queueWriteBack( const string& remote , const BSONObj& o ) { static mongo::mutex xxx( "WriteBackManager::queueWriteBack tmp" ); static OID lastOID; scoped_lock lk( xxx ); const BSONElement& e = o["id"]; if ( lastOID.isSet() ) { if ( e.OID() < lastOID ) { log() << "this could fail" << endl; printStackTrace(); } } lastOID = e.OID(); getWritebackQueue( remote )->queue.push( o ); }
void WriteBackManager::queueWriteBack( const string& remote , const BSONObj& o ) { getWritebackQueue( remote )->queue.push( o ); }
void queueWriteBack( const string& remote , const BSONObj& o ){ getWritebackQueue( remote )->push( o ); }