| 205 | } |
| 206 | |
| 207 | static int table_iter_next(struct table_iter *ti, struct reftable_record *rec) |
| 208 | { |
| 209 | if (reftable_record_type(rec) != ti->typ) |
| 210 | return REFTABLE_API_ERROR; |
| 211 | |
| 212 | while (1) { |
| 213 | int err; |
| 214 | |
| 215 | if (ti->is_finished) |
| 216 | return 1; |
| 217 | |
| 218 | /* |
| 219 | * Check whether the current block still has more records. If |
| 220 | * so, return it. If the iterator returns positive then the |
| 221 | * current block has been exhausted. |
| 222 | */ |
| 223 | err = table_iter_next_in_block(ti, rec); |
| 224 | if (err <= 0) |
| 225 | return err; |
| 226 | |
| 227 | /* |
| 228 | * Otherwise, we need to continue to the next block in the |
| 229 | * table and retry. If there are no more blocks then the |
| 230 | * iterator is drained. |
| 231 | */ |
| 232 | err = table_iter_next_block(ti); |
| 233 | if (err) { |
| 234 | ti->is_finished = 1; |
| 235 | return err; |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | static int table_iter_seek_to(struct table_iter *ti, uint64_t off, uint8_t typ) |
| 241 | { |
no test coverage detected