Thread (73 messages) 73 messages, 3 authors, 2026-03-05

Re: [PATCH 11/17] odb/source: make `for_each_object()` function pluggable

From: Patrick Steinhardt <hidden>
Date: 2026-03-05 13:31:00

On Thu, Mar 05, 2026 at 01:07:15PM +0000, Karthik Nayak wrote:
[snip]
quoted
diff --git a/odb/source.h b/odb/source.h
index edb425fdef..35aa78e140 100644
--- a/odb/source.h
+++ b/odb/source.h
@@ -151,6 +163,27 @@ struct odb_source {
 	int (*read_object_stream)(struct odb_read_stream **out,
 				  struct odb_source *source,
 				  const struct object_id *oid);
+
+	/*
+	 * This callback is expected to iterate over all objects stored in this
This isn't a callback though, this is a function which calls the
callback, right?
No, this is the callback function in the `struct odb_source`. That
callback in turn ends up invoking another callback though :)
quoted
+	 * source and invoke the callback function for each of them. It is
+	 * valid to yield the same object multiple time. A non-zero exit code
+	 * from the object callback shall abort iteration.
+	 *
+	 * The optional `oi` structure shall be populated similar to how an individual
+	 * call to `odb_source_read_object_info()` would have behaved. If the caller
+	 * passes a `NULL` pointer then the object itself shall not be read.
+	 *
Nit: here and below, we talk about the `oi` structure, but that's in the
callback function, maybe we should clarify that.
Ah, this is still somewhat stale from an earlier iteration where `oi`
and `request` were the same thing, and `request` was non-const. Will
fix.

Patrick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help