| 144 | } |
| 145 | |
| 146 | void TwoLevelIterator::InitDataBlock() { |
| 147 | if (!index_iter_.Valid()) { |
| 148 | SetDataIterator(nullptr); |
| 149 | } else { |
| 150 | Slice handle = index_iter_.value(); |
| 151 | if (data_iter_.iter() != nullptr && |
| 152 | handle.compare(data_block_handle_) == 0) { |
| 153 | // data_iter_ is already constructed with this iterator, so |
| 154 | // no need to change anything |
| 155 | } else { |
| 156 | Iterator* iter = (*block_function_)(arg_, options_, handle); |
| 157 | data_block_handle_.assign(handle.data(), handle.size()); |
| 158 | SetDataIterator(iter); |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | } // namespace |
| 164 | |