aboutsummaryrefslogtreecommitdiff
path: root/reftable/reftable-stack.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-05-13 10:47:56 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-13 17:04:19 -0700
commit08efe69212fc158fb17294fc3396fa9d048d2285 (patch)
tree123cb3f2a7b3d7880798fb23875c2b477b632078 /reftable/reftable-stack.h
parent0e7be2b3ea444fc5375e76e42d81b1e1d3d4971f (diff)
downloadgit-08efe69212fc158fb17294fc3396fa9d048d2285.tar.xz
reftable/stack: provide convenience functions to create iterators
There exist a bunch of call sites in the reftable backend that want to create iterators for a reftable stack. This is rather convoluted right now, where you always have to go via the merged table. And it is about to become even more convoluted when we split up iterator initialization and seeking in the next commit. Introduce convenience functions that allow the caller to create an iterator from a reftable stack directly without going through the merged table. Adapt callers accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/reftable-stack.h')
-rw-r--r--reftable/reftable-stack.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/reftable/reftable-stack.h b/reftable/reftable-stack.h
index 1b602dda58..26740e6073 100644
--- a/reftable/reftable-stack.h
+++ b/reftable/reftable-stack.h
@@ -66,6 +66,24 @@ int reftable_stack_add(struct reftable_stack *st,
void *write_arg),
void *write_arg);
+struct reftable_iterator;
+
+/*
+ * Initialize an iterator for the merged tables contained in the stack that can
+ * be used to iterate through refs. The iterator is valid until the next reload
+ * or write.
+ */
+void reftable_stack_init_ref_iterator(struct reftable_stack *st,
+ struct reftable_iterator *it);
+
+/*
+ * Initialize an iterator for the merged tables contained in the stack that can
+ * be used to iterate through logs. The iterator is valid until the next reload
+ * or write.
+ */
+void reftable_stack_init_log_iterator(struct reftable_stack *st,
+ struct reftable_iterator *it);
+
/* returns the merged_table for seeking. This table is valid until the
* next write or reload, and should not be closed or deleted.
*/