Subject: Re: [PATCH 17/17] odb/source: make `begin_transaction()` function pluggable

From: Justin Tobler <[email-masked]>
Date: Wed, 4 Mar 2026 16:01:32 -0600

On 26/02/23 05:18PM, Patrick Steinhardt wrote:
> Introduce a new callback function in `struct odb_source` to make the
> function pluggable.
> 
> Signed-off-by: Patrick Steinhardt <[email-masked]>
> ---
>  odb/source-files.c | 11 +++++++++++
>  odb/source.h       | 27 +++++++++++++++++++++++++++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/odb/source-files.c b/odb/source-files.c
> index c32cd67b26..14cb9adeca 100644
> --- a/odb/source-files.c
> +++ b/odb/source-files.c
> @@ -122,6 +122,16 @@ static int odb_source_files_write_object_stream(struct odb_source *source,
>  	return odb_source_loose_write_stream(source, stream, len, oid);
>  }
>  
> +static int odb_source_files_begin_transaction(struct odb_source *source,
> +					      struct odb_transaction **out)
> +{
> +	struct odb_transaction *tx = odb_transaction_files_begin(source);

For a given ODB source, I would always expect that the resulting
transaction would always be of the same source type. This makes me think
that the underlying logic to handle transactions should also live along
side the concrete ODB source implementation. Doesn't have to be a part
of this series, but maybe in the future we should just merge
odb_transaction_files_begin() into here.

-Justin