Re: [PATCH 6/7] odb: introduce object filters to `odb_for_each_object()`
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Jul 9, 2026, 21:43 UTC
- Message-ID
- <alATd_YS2d_l3CHq@denethor>
- In-Reply-To
- <20260709-pks-odb-for-each-object-filter-v1-6-82fe014b12b3@pks.im>
On 26/07/09 10:35AM, Patrick Steinhardt wrote:
Show 19 quoted lines
> The function `for_each_bitmapped_object()` can be used to iterate > through all objects covered by a bitmap. The benefit of this function is > that it allows the caller to efficiently handle some object filters. For > example, this can be used to filter out objects of a specific type with > some simple bitmap operations. But callers are currently required to > manually wire up the use of bitmaps though, and to do so they have to > reach into internals of a given object database source. > > Introduce a new `struct odb_for_each_object_options::filter` field so > that the interface becomes generic. When set, then a backend may > optionally use the filter to skip some objects that it would have > otherwise yielded. > > Note that the respective backends are free to ignore this field if they > cannot meaningfully optimize for a given filter, and consequently > callers need to verify whether they actually want the returned objects. > While annoying, we cannot easily lift this restriction anyway as the > object filter infrastructure supports some filters that cannot be > answered by the object database alone.
Huh, this feels rather awkward. So callers will always still have to ensure correctness by filtering the result a second time? IIUC, the idea is that the backend may be able to more efficiently process object filtering so we would want it to attempt the first pass.
Is there a subset of object filters that we should expect any backend to be able to answer? If so, maybe we should define a separate list of object filter options specific to this interface? Any filtering not supported would have to be deligated to the caller then.
-Justin