diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-07-08 12:40:15 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-07-16 14:37:02 -0400 |
commit | c832bc753c29f91597b75fa02c0d9019c3c20b0f (patch) | |
tree | 5324f665212988a354ff6ba254b239dc594d2c7d /src/mongo/db/exec/text.cpp | |
parent | f64b6c596f9dcd1bae7011a3230b517386baa255 (diff) | |
download | mongo-c832bc753c29f91597b75fa02c0d9019c3c20b0f.tar.gz |
SERVER-17364 Unify handling of child stages into PlanStage base class
This is prep for adding more methods that need to propagate to children.
Diffstat (limited to 'src/mongo/db/exec/text.cpp')
-rw-r--r-- | src/mongo/db/exec/text.cpp | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp index 56192851bd9..b7cc0789286 100644 --- a/src/mongo/db/exec/text.cpp +++ b/src/mongo/db/exec/text.cpp @@ -60,16 +60,15 @@ TextStage::TextStage(OperationContext* txn, const TextStageParams& params, WorkingSet* ws, const MatchExpression* filter) - : _params(params), _textTreeRoot(buildTextTree(txn, ws, filter)), _commonStats(kStageType) { + : PlanStage(kStageType), _params(params) { + _children.emplace_back(buildTextTree(txn, ws, filter)); _specificStats.indexPrefix = _params.indexPrefix; _specificStats.indexName = _params.index->indexName(); _specificStats.parsedTextQuery = _params.query.toBSON(); } -TextStage::~TextStage() {} - bool TextStage::isEOF() { - return _textTreeRoot->isEOF(); + return child()->isEOF(); } PlanStage::StageState TextStage::work(WorkingSetID* out) { @@ -82,7 +81,7 @@ PlanStage::StageState TextStage::work(WorkingSetID* out) { return PlanStage::IS_EOF; } - PlanStage::StageState stageState = _textTreeRoot->work(out); + PlanStage::StageState stageState = child()->work(out); // Increment common stats counters that are specific to the return value of work(). switch (stageState) { @@ -102,41 +101,15 @@ PlanStage::StageState TextStage::work(WorkingSetID* out) { return stageState; } -void TextStage::saveState() { - ++_commonStats.yields; - - _textTreeRoot->saveState(); -} - -void TextStage::restoreState(OperationContext* opCtx) { - ++_commonStats.unyields; - - _textTreeRoot->restoreState(opCtx); -} - -void TextStage::invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) { - ++_commonStats.invalidates; - - _textTreeRoot->invalidate(txn, dl, type); -} - -vector<PlanStage*> TextStage::getChildren() const { - return {_textTreeRoot.get()}; -} - unique_ptr<PlanStageStats> TextStage::getStats() { _commonStats.isEOF = isEOF(); unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_TEXT); ret->specific = make_unique<TextStats>(_specificStats); - ret->children.push_back(_textTreeRoot->getStats().release()); + ret->children.push_back(child()->getStats().release()); return ret; } -const CommonStats* TextStage::getCommonStats() const { - return &_commonStats; -} - const SpecificStats* TextStage::getSpecificStats() const { return &_specificStats; } |