summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/fetch.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/fetch.h')
-rw-r--r--src/mongo/db/exec/fetch.h134
1 files changed, 67 insertions, 67 deletions
diff --git a/src/mongo/db/exec/fetch.h b/src/mongo/db/exec/fetch.h
index 3d0962a3508..1ba3ba427e2 100644
--- a/src/mongo/db/exec/fetch.h
+++ b/src/mongo/db/exec/fetch.h
@@ -37,82 +37,82 @@
namespace mongo {
- /**
- * This stage turns a RecordId into a BSONObj.
- *
- * In WorkingSetMember terms, it transitions from LOC_AND_IDX to LOC_AND_OBJ by reading
- * the record at the provided loc. Returns verbatim any data that already has an object.
- *
- * Preconditions: Valid RecordId.
- */
- class FetchStage : public PlanStage {
- public:
- FetchStage(OperationContext* txn,
- WorkingSet* ws,
- PlanStage* child,
- const MatchExpression* filter,
- const Collection* collection);
-
- virtual ~FetchStage();
-
- 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 std::vector<PlanStage*> getChildren() const;
-
- virtual StageType stageType() const { return STAGE_FETCH; }
-
- PlanStageStats* getStats();
-
- virtual const CommonStats* getCommonStats();
+/**
+ * This stage turns a RecordId into a BSONObj.
+ *
+ * In WorkingSetMember terms, it transitions from LOC_AND_IDX to LOC_AND_OBJ by reading
+ * the record at the provided loc. Returns verbatim any data that already has an object.
+ *
+ * Preconditions: Valid RecordId.
+ */
+class FetchStage : public PlanStage {
+public:
+ FetchStage(OperationContext* txn,
+ WorkingSet* ws,
+ PlanStage* child,
+ const MatchExpression* filter,
+ const Collection* collection);
- virtual const SpecificStats* getSpecificStats();
+ virtual ~FetchStage();
- static const char* kStageType;
+ virtual bool isEOF();
+ virtual StageState work(WorkingSetID* out);
- private:
+ virtual void saveState();
+ virtual void restoreState(OperationContext* opCtx);
+ virtual void invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type);
- /**
- * If the member (with id memberID) passes our filter, set *out to memberID and return that
- * ADVANCED. Otherwise, free memberID and return NEED_TIME.
- */
- StageState returnIfMatches(WorkingSetMember* member, WorkingSetID memberID,
- WorkingSetID* out);
+ virtual std::vector<PlanStage*> getChildren() const;
- OperationContext* _txn;
+ virtual StageType stageType() const {
+ return STAGE_FETCH;
+ }
- // Collection which is used by this stage. Used to resolve record ids retrieved by child
- // stages. The lifetime of the collection must supersede that of the stage.
- const Collection* _collection;
+ PlanStageStats* getStats();
- // _ws is not owned by us.
- WorkingSet* _ws;
- boost::scoped_ptr<PlanStage> _child;
+ virtual const CommonStats* getCommonStats();
- // The filter is not owned by us.
- const MatchExpression* _filter;
+ virtual const SpecificStats* getSpecificStats();
- // 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.
- //
- // Some stages which request fetches don't need to use '_idBeingPagedIn' (e.g.,
- // CollectionScan) because they are implemented with an underlying iterator which keeps
- // track of the next WSM to be returned. A FetchStage has no such iterator, but rather
- // streams its results from the child. Therefore, when it requests a yield via NEED_FETCH,
- // the current WSM must be saved so that the fetched result can be returned on the next
- // call to work(). This also requires special invalidation handling not found in stages like
- // CollectionScan for when '_idBeingPagedIn' is invalidated before it can be returned.
- WorkingSetID _idBeingPagedIn;
+ static const char* kStageType;
- // Stats
- CommonStats _commonStats;
- FetchStats _specificStats;
- };
+private:
+ /**
+ * If the member (with id memberID) passes our filter, set *out to memberID and return that
+ * ADVANCED. Otherwise, free memberID and return NEED_TIME.
+ */
+ StageState returnIfMatches(WorkingSetMember* member, WorkingSetID memberID, WorkingSetID* out);
+
+ OperationContext* _txn;
+
+ // Collection which is used by this stage. Used to resolve record ids retrieved by child
+ // stages. The lifetime of the collection must supersede that of the stage.
+ const Collection* _collection;
+
+ // _ws is not owned by us.
+ WorkingSet* _ws;
+ boost::scoped_ptr<PlanStage> _child;
+
+ // The filter is not owned by us.
+ const MatchExpression* _filter;
+
+ // 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.
+ //
+ // Some stages which request fetches don't need to use '_idBeingPagedIn' (e.g.,
+ // CollectionScan) because they are implemented with an underlying iterator which keeps
+ // track of the next WSM to be returned. A FetchStage has no such iterator, but rather
+ // streams its results from the child. Therefore, when it requests a yield via NEED_FETCH,
+ // the current WSM must be saved so that the fetched result can be returned on the next
+ // call to work(). This also requires special invalidation handling not found in stages like
+ // CollectionScan for when '_idBeingPagedIn' is invalidated before it can be returned.
+ WorkingSetID _idBeingPagedIn;
+
+ // Stats
+ CommonStats _commonStats;
+ FetchStats _specificStats;
+};
} // namespace mongo