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/query/internal_plans.cpp | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/query/internal_plans.cpp')
-rw-r--r-- | src/mongo/db/query/internal_plans.cpp | 147 |
1 files changed, 68 insertions, 79 deletions
diff --git a/src/mongo/db/query/internal_plans.cpp b/src/mongo/db/query/internal_plans.cpp index 9a38020d00a..fe44395f021 100644 --- a/src/mongo/db/query/internal_plans.cpp +++ b/src/mongo/db/query/internal_plans.cpp @@ -40,91 +40,80 @@ namespace mongo { - // static - PlanExecutor* InternalPlanner::collectionScan(OperationContext* txn, - StringData ns, - Collection* collection, - const Direction direction, - const RecordId startLoc) { - WorkingSet* ws = new WorkingSet(); - - if (NULL == collection) { - EOFStage* eof = new EOFStage(); - PlanExecutor* exec; - // Takes ownership of 'ws' and 'eof'. - Status execStatus = PlanExecutor::make(txn, - ws, - eof, - ns.toString(), - PlanExecutor::YIELD_MANUAL, - &exec); - invariant(execStatus.isOK()); - return exec; - } - - invariant( ns == collection->ns().ns() ); - - CollectionScanParams params; - params.collection = collection; - params.start = startLoc; - - if (FORWARD == direction) { - params.direction = CollectionScanParams::FORWARD; - } - else { - params.direction = CollectionScanParams::BACKWARD; - } - - CollectionScan* cs = new CollectionScan(txn, params, ws, NULL); +// static +PlanExecutor* InternalPlanner::collectionScan(OperationContext* txn, + StringData ns, + Collection* collection, + const Direction direction, + const RecordId startLoc) { + WorkingSet* ws = new WorkingSet(); + + if (NULL == collection) { + EOFStage* eof = new EOFStage(); PlanExecutor* exec; - // Takes ownership of 'ws' and 'cs'. - Status execStatus = PlanExecutor::make(txn, - ws, - cs, - collection, - PlanExecutor::YIELD_MANUAL, - &exec); + // Takes ownership of 'ws' and 'eof'. + Status execStatus = + PlanExecutor::make(txn, ws, eof, ns.toString(), PlanExecutor::YIELD_MANUAL, &exec); invariant(execStatus.isOK()); return exec; } - // static - PlanExecutor* InternalPlanner::indexScan(OperationContext* txn, - const Collection* collection, - const IndexDescriptor* descriptor, - const BSONObj& startKey, const BSONObj& endKey, - bool endKeyInclusive, Direction direction, - int options) { - invariant(collection); - invariant(descriptor); - - IndexScanParams params; - params.descriptor = descriptor; - params.direction = direction; - params.bounds.isSimpleRange = true; - params.bounds.startKey = startKey; - params.bounds.endKey = endKey; - params.bounds.endKeyInclusive = endKeyInclusive; - - WorkingSet* ws = new WorkingSet(); - IndexScan* ix = new IndexScan(txn, params, ws, NULL); - - PlanStage* root = ix; - - if (IXSCAN_FETCH & options) { - root = new FetchStage(txn, ws, root, NULL, collection); - } + invariant(ns == collection->ns().ns()); - PlanExecutor* exec; - // Takes ownership of 'ws' and 'root'. - Status execStatus = PlanExecutor::make(txn, - ws, - root, - collection, - PlanExecutor::YIELD_MANUAL, - &exec); - invariant(execStatus.isOK()); - return exec; + CollectionScanParams params; + params.collection = collection; + params.start = startLoc; + + if (FORWARD == direction) { + params.direction = CollectionScanParams::FORWARD; + } else { + params.direction = CollectionScanParams::BACKWARD; } + CollectionScan* cs = new CollectionScan(txn, params, ws, NULL); + PlanExecutor* exec; + // Takes ownership of 'ws' and 'cs'. + Status execStatus = + PlanExecutor::make(txn, ws, cs, collection, PlanExecutor::YIELD_MANUAL, &exec); + invariant(execStatus.isOK()); + return exec; +} + +// static +PlanExecutor* InternalPlanner::indexScan(OperationContext* txn, + const Collection* collection, + const IndexDescriptor* descriptor, + const BSONObj& startKey, + const BSONObj& endKey, + bool endKeyInclusive, + Direction direction, + int options) { + invariant(collection); + invariant(descriptor); + + IndexScanParams params; + params.descriptor = descriptor; + params.direction = direction; + params.bounds.isSimpleRange = true; + params.bounds.startKey = startKey; + params.bounds.endKey = endKey; + params.bounds.endKeyInclusive = endKeyInclusive; + + WorkingSet* ws = new WorkingSet(); + IndexScan* ix = new IndexScan(txn, params, ws, NULL); + + PlanStage* root = ix; + + if (IXSCAN_FETCH & options) { + root = new FetchStage(txn, ws, root, NULL, collection); + } + + PlanExecutor* exec; + // Takes ownership of 'ws' and 'root'. + Status execStatus = + PlanExecutor::make(txn, ws, root, collection, PlanExecutor::YIELD_MANUAL, &exec); + invariant(execStatus.isOK()); + return exec; +} + } // namespace mongo |