voidVersion::AddIterators(const ReadOptions& options, std::vector<Iterator*>* iters){ // Merge all level zero files together since they may overlap // 加入所有level0的files iterator for (size_t i = 0; i < files_[0].size(); i++) { iters->push_back(vset_->table_cache_->NewIterator( options, files_[0][i]->number, files_[0][i]->file_size)); }
// 对于levels>0, 每层加入一个concatenating iterator即可。 // For levels > 0, we can use a concatenating iterator that sequentially // walks through the non-overlapping files in the level, opening them // lazily. for (int level = 1; level < config::kNumLevels; level++) { if (!files_[level].empty()) { iters->push_back(NewConcatenatingIterator(options, level)); } } }