From 0a148a8eda7da6f7ff039ff2ea62b143ceb57f2f Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 16 Sep 2024 10:50:14 +0200 Subject: reftable/reader: make table iterator reseekable In 67ce50ba26 (Merge branch 'ps/reftable-reusable-iterator', 2024-05-30) we have refactored the interface of reftable iterators such that they can be reused in theory. This patch series only landed the required changes on the interface level, but didn't yet implement the actual logic to make iterators reusable. As it turns out almost all of the infrastructure already does support re-seeking. The only exception is the table iterator, which does not reset its `is_finished` bit. Do so and add a couple of tests that verify that we can re-seek iterators. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- reftable/reader.c | 1 + 1 file changed, 1 insertion(+) (limited to 'reftable/reader.c') diff --git a/reftable/reader.c b/reftable/reader.c index f877099087..6494ce2e32 100644 --- a/reftable/reader.c +++ b/reftable/reader.c @@ -328,6 +328,7 @@ static int table_iter_seek_to(struct table_iter *ti, uint64_t off, uint8_t typ) ti->typ = block_reader_type(&ti->br); ti->block_off = off; block_iter_seek_start(&ti->bi, &ti->br); + ti->is_finished = 0; return 0; } -- cgit v1.3