diff options
Diffstat (limited to 'src/mongo/db/exec/idhack.h')
-rw-r--r-- | src/mongo/db/exec/idhack.h | 115 |
1 files changed, 59 insertions, 56 deletions
diff --git a/src/mongo/db/exec/idhack.h b/src/mongo/db/exec/idhack.h index 5430addd12b..b4dc87c1b84 100644 --- a/src/mongo/db/exec/idhack.h +++ b/src/mongo/db/exec/idhack.h @@ -37,83 +37,86 @@ namespace mongo { - class RecordCursor; +class RecordCursor; - /** - * A standalone stage implementing the fast path for key-value retrievals - * via the _id index. - */ - class IDHackStage : public PlanStage { - public: - /** Takes ownership of all the arguments -collection. */ - IDHackStage(OperationContext* txn, const Collection* collection, - CanonicalQuery* query, WorkingSet* ws); +/** + * A standalone stage implementing the fast path for key-value retrievals + * via the _id index. + */ +class IDHackStage : public PlanStage { +public: + /** Takes ownership of all the arguments -collection. */ + IDHackStage(OperationContext* txn, + const Collection* collection, + CanonicalQuery* query, + WorkingSet* ws); - IDHackStage(OperationContext* txn, Collection* collection, - const BSONObj& key, WorkingSet* ws); + IDHackStage(OperationContext* txn, Collection* collection, const BSONObj& key, WorkingSet* ws); - virtual ~IDHackStage(); + virtual ~IDHackStage(); - virtual bool isEOF(); - virtual StageState work(WorkingSetID* out); + virtual bool isEOF(); + virtual StageState work(WorkingSetID* out); - virtual void saveState(); - virtual void restoreState(OperationContext* opCtx); - virtual void invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); + virtual void invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); - /** - * ID Hack has a very strict criteria for the queries it supports. - */ - static bool supportsQuery(const CanonicalQuery& query); + /** + * ID Hack has a very strict criteria for the queries it supports. + */ + static bool supportsQuery(const CanonicalQuery& query); - virtual std::vector<PlanStage*> getChildren() const; + virtual std::vector<PlanStage*> getChildren() const; - virtual StageType stageType() const { return STAGE_IDHACK; } + virtual StageType stageType() const { + return STAGE_IDHACK; + } - PlanStageStats* getStats(); + PlanStageStats* getStats(); - virtual const CommonStats* getCommonStats() const; + virtual const CommonStats* getCommonStats() const; - virtual const SpecificStats* getSpecificStats() const; + virtual const SpecificStats* getSpecificStats() const; - static const char* kStageType; + static const char* kStageType; - private: - /** - * Marks this stage as done, optionally adds key metadata, and returns PlanStage::ADVANCED. - * - * Called whenever we have a WSM containing the matching obj. - */ - StageState advance(WorkingSetID id, WorkingSetMember* member, WorkingSetID* out); +private: + /** + * Marks this stage as done, optionally adds key metadata, and returns PlanStage::ADVANCED. + * + * Called whenever we have a WSM containing the matching obj. + */ + StageState advance(WorkingSetID id, WorkingSetMember* member, WorkingSetID* out); - // transactional context for read locks. Not owned by us - OperationContext* _txn; + // transactional context for read locks. Not owned by us + OperationContext* _txn; - // Not owned here. - const Collection* _collection; + // Not owned here. + const Collection* _collection; - std::unique_ptr<RecordCursor> _recordCursor; + std::unique_ptr<RecordCursor> _recordCursor; - // The WorkingSet we annotate with results. Not owned by us. - WorkingSet* _workingSet; + // The WorkingSet we annotate with results. Not owned by us. + WorkingSet* _workingSet; - // The value to match against the _id field. - BSONObj _key; + // The value to match against the _id field. + BSONObj _key; - // Have we returned our one document? - bool _done; + // Have we returned our one document? + bool _done; - // Do we need to add index key metadata for $returnKey? - bool _addKeyMetadata; + // Do we need to add index key metadata for $returnKey? + bool _addKeyMetadata; - // If we want to return a RecordId and it points to something that's not in memory, - // we return a "please page this in" result. We add a RecordFetcher given back to us by the - // storage engine to the WSM. The RecordFetcher is used by the PlanExecutor when it handles - // the fetch request. - WorkingSetID _idBeingPagedIn; + // If we want to return a RecordId and it points to something that's not in memory, + // we return a "please page this in" result. We add a RecordFetcher given back to us by the + // storage engine to the WSM. The RecordFetcher is used by the PlanExecutor when it handles + // the fetch request. + WorkingSetID _idBeingPagedIn; - CommonStats _commonStats; - IDHackStats _specificStats; - }; + CommonStats _commonStats; + IDHackStats _specificStats; +}; } // namespace mongo |