| 1216 | } |
| 1217 | |
| 1218 | Status SubarrayPartitioner::next_from_single_range(bool* unsplittable) { |
| 1219 | // Handle case where a new single range must be put in the list and split |
| 1220 | if (state_.single_range_.empty()) { |
| 1221 | auto s = subarray_.get_subarray(current_.start_, current_.end_); |
| 1222 | state_.single_range_.push_front(std::move(s)); |
| 1223 | throw_if_not_ok(split_top_single_range(unsplittable)); |
| 1224 | } |
| 1225 | |
| 1226 | // Loop until you find a partition that fits or unsplittable |
| 1227 | if (!*unsplittable) { |
| 1228 | bool must_split; |
| 1229 | do { |
| 1230 | auto& partition = state_.single_range_.front(); |
| 1231 | must_split = this->must_split(&partition); |
| 1232 | if (must_split) |
| 1233 | RETURN_NOT_OK(split_top_single_range(unsplittable)); |
| 1234 | } while (must_split && !*unsplittable); |
| 1235 | } |
| 1236 | |
| 1237 | // At this point, the top range is the next partition |
| 1238 | current_.partition_ = std::move(state_.single_range_.front()); |
| 1239 | current_.split_multi_range_ = false; |
| 1240 | state_.single_range_.pop_front(); |
| 1241 | if (state_.single_range_.empty()) |
| 1242 | state_.start_++; |
| 1243 | |
| 1244 | return Status::Ok(); |
| 1245 | } |
| 1246 | |
| 1247 | Status SubarrayPartitioner::split_top_single_range(bool* unsplittable) { |
| 1248 | // For easy reference |
nothing calls this directly
no test coverage detected