diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 00:22:50 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 10:56:02 -0400 |
commit | 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch) | |
tree | 3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/repl/oplog_interface_local.cpp | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/repl/oplog_interface_local.cpp')
-rw-r--r-- | src/mongo/db/repl/oplog_interface_local.cpp | 106 |
1 files changed, 48 insertions, 58 deletions
diff --git a/src/mongo/db/repl/oplog_interface_local.cpp b/src/mongo/db/repl/oplog_interface_local.cpp index c005865e9b0..30c9a7ab9e5 100644 --- a/src/mongo/db/repl/oplog_interface_local.cpp +++ b/src/mongo/db/repl/oplog_interface_local.cpp @@ -41,67 +41,57 @@ namespace repl { namespace { - class OplogIteratorLocal : public OplogInterface::Iterator { - public: - - OplogIteratorLocal(OperationContext* txn, - const std::string& collectionName); - - StatusWith<Value> next() override; - - private: - - ScopedTransaction _transaction; - Lock::DBLock _dbLock; - Lock::CollectionLock _collectionLock; - OldClientContext _ctx; - std::unique_ptr<PlanExecutor> _exec; - - }; - - OplogIteratorLocal::OplogIteratorLocal(OperationContext* txn, - const std::string& collectionName) - : _transaction(txn, MODE_IS), - _dbLock(txn->lockState(), nsToDatabase(collectionName), MODE_IS), - _collectionLock(txn->lockState(), collectionName, MODE_S), - _ctx(txn, collectionName), - _exec(InternalPlanner::collectionScan(txn, - collectionName, - _ctx.db()->getCollection(collectionName), - InternalPlanner::BACKWARD)) { } - - StatusWith<OplogInterface::Iterator::Value> OplogIteratorLocal::next() { - BSONObj obj; - RecordId recordId; - - if (PlanExecutor::ADVANCED != _exec->getNext(&obj, &recordId)) { - return StatusWith<Value>(ErrorCodes::NoSuchKey, "no more operations in local oplog"); - } - return StatusWith<Value>(std::make_pair(obj, recordId)); +class OplogIteratorLocal : public OplogInterface::Iterator { +public: + OplogIteratorLocal(OperationContext* txn, const std::string& collectionName); + + StatusWith<Value> next() override; + +private: + ScopedTransaction _transaction; + Lock::DBLock _dbLock; + Lock::CollectionLock _collectionLock; + OldClientContext _ctx; + std::unique_ptr<PlanExecutor> _exec; +}; + +OplogIteratorLocal::OplogIteratorLocal(OperationContext* txn, const std::string& collectionName) + : _transaction(txn, MODE_IS), + _dbLock(txn->lockState(), nsToDatabase(collectionName), MODE_IS), + _collectionLock(txn->lockState(), collectionName, MODE_S), + _ctx(txn, collectionName), + _exec(InternalPlanner::collectionScan(txn, + collectionName, + _ctx.db()->getCollection(collectionName), + InternalPlanner::BACKWARD)) {} + +StatusWith<OplogInterface::Iterator::Value> OplogIteratorLocal::next() { + BSONObj obj; + RecordId recordId; + + if (PlanExecutor::ADVANCED != _exec->getNext(&obj, &recordId)) { + return StatusWith<Value>(ErrorCodes::NoSuchKey, "no more operations in local oplog"); } + return StatusWith<Value>(std::make_pair(obj, recordId)); +} -} // namespace +} // namespace - OplogInterfaceLocal::OplogInterfaceLocal(OperationContext* txn, - const std::string& collectionName) - : _txn(txn), - _collectionName(collectionName) { +OplogInterfaceLocal::OplogInterfaceLocal(OperationContext* txn, const std::string& collectionName) + : _txn(txn), _collectionName(collectionName) { + invariant(txn); + invariant(!collectionName.empty()); +} - invariant(txn); - invariant(!collectionName.empty()); - } - - std::string OplogInterfaceLocal::toString() const { - return str::stream() << - "LocalOplogInterface: " - "operation context: " << _txn->getNS() << "/" << _txn->getOpID() << - "; collection: " << _collectionName; - } +std::string OplogInterfaceLocal::toString() const { + return str::stream() << "LocalOplogInterface: " + "operation context: " << _txn->getNS() << "/" << _txn->getOpID() + << "; collection: " << _collectionName; +} - std::unique_ptr<OplogInterface::Iterator> OplogInterfaceLocal::makeIterator() const { - return std::unique_ptr<OplogInterface::Iterator>( - new OplogIteratorLocal(_txn, _collectionName)); - } +std::unique_ptr<OplogInterface::Iterator> OplogInterfaceLocal::makeIterator() const { + return std::unique_ptr<OplogInterface::Iterator>(new OplogIteratorLocal(_txn, _collectionName)); +} -} // namespace repl -} // namespace mongo +} // namespace repl +} // namespace mongo |