diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-01-04 00:40:41 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-01-04 00:40:41 -0500 |
commit | b828d21630d8715fff5a30c682a51ab79880093d (patch) | |
tree | cbbc46069dcfc08ab1525ec06a5dff5967dde148 /s/d_writeback.cpp | |
parent | 4315a900ae604e11f2d9d68d1e6f87b8aa01dddc (diff) | |
download | mongo-b828d21630d8715fff5a30c682a51ab79880093d.tar.gz |
ran astyle SERVER-2304
Diffstat (limited to 's/d_writeback.cpp')
-rw-r--r-- | s/d_writeback.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/s/d_writeback.cpp b/s/d_writeback.cpp index 46b7893cc3b..401e0aa1638 100644 --- a/s/d_writeback.cpp +++ b/s/d_writeback.cpp @@ -32,29 +32,29 @@ namespace mongo { // TODO init at mongod startup WriteBackManager writeBackManager; - WriteBackManager::WriteBackManager() : _writebackQueueLock("sharding:writebackQueueLock"){ + WriteBackManager::WriteBackManager() : _writebackQueueLock("sharding:writebackQueueLock") { } - WriteBackManager::~WriteBackManager(){ + WriteBackManager::~WriteBackManager() { } - void WriteBackManager::queueWriteBack( const string& remote , const BSONObj& o ){ + void WriteBackManager::queueWriteBack( const string& remote , const BSONObj& o ) { getWritebackQueue( remote )->push( o ); } - BlockingQueue<BSONObj>* WriteBackManager::getWritebackQueue( const string& remote ){ + BlockingQueue<BSONObj>* WriteBackManager::getWritebackQueue( const string& remote ) { scoped_lock lk ( _writebackQueueLock ); BlockingQueue<BSONObj>*& q = _writebackQueues[remote]; if ( ! q ) q = new BlockingQueue<BSONObj>(); return q; - } + } - bool WriteBackManager::queuesEmpty() const{ + bool WriteBackManager::queuesEmpty() const { scoped_lock lk( _writebackQueueLock ); - for ( WriteBackQueuesMap::const_iterator it = _writebackQueues.begin(); it != _writebackQueues.end(); ++it ){ + for ( WriteBackQueuesMap::const_iterator it = _writebackQueues.begin(); it != _writebackQueues.end(); ++it ) { const BlockingQueue<BSONObj>* queue = it->second; - if (! queue->empty() ){ + if (! queue->empty() ) { return false; } } @@ -66,25 +66,25 @@ namespace mongo { // Note, this command will block until there is something to WriteBack class WriteBackCommand : public Command { public: - virtual LockType locktype() const { return NONE; } + virtual LockType locktype() const { return NONE; } virtual bool slaveOk() const { return true; } virtual bool adminOnly() const { return true; } - - WriteBackCommand() : Command( "writebacklisten" ){} + + WriteBackCommand() : Command( "writebacklisten" ) {} void help(stringstream& h) const { h<<"internal"; } - bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool){ + bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool) { BSONElement e = cmdObj.firstElement(); - if ( e.type() != jstOID ){ + if ( e.type() != jstOID ) { errmsg = "need oid as first value"; return 0; } // get the command issuer's (a mongos) serverID const OID id = e.__oid(); - + // the command issuer is blocked awaiting a response // we want to do return at least at every 5 minutes so sockets don't timeout BSONObj z; @@ -95,25 +95,25 @@ namespace mongo { else { result.appendBool( "noop" , true ); } - + return true; } } writeBackCommand; class WriteBacksQueuedCommand : public Command { public: - virtual LockType locktype() const { return NONE; } + virtual LockType locktype() const { return NONE; } virtual bool slaveOk() const { return true; } virtual bool adminOnly() const { return true; } - - WriteBacksQueuedCommand() : Command( "writeBacksQueued" ){} - void help(stringstream& help) const { + WriteBacksQueuedCommand() : Command( "writeBacksQueued" ) {} + + void help(stringstream& help) const { help << "Returns whether there are operations in the writeback queue at the time the command was called. " - << "This is an internal comand"; + << "This is an internal comand"; } - bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool){ + bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool) { result.appendBool( "hasOpsQueued" , ! writeBackManager.queuesEmpty() ); return true; } |