Re: [PATCH 17/17] odb/source: make `begin_transaction()` function pluggable
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Mar 4, 2026, 22:01 UTC
- Message-ID
- <aaiqJlmFgi92a0iC@denethor>
- In-Reply-To
- <20260223-b4-pks-odb-source-pluggable-v1-17-253bac1db598@pks.im>
On 26/02/23 05:18PM, Patrick Steinhardt wrote:
Show 21 quoted lines
> Introduce a new callback function in `struct odb_source` to make the
> function pluggable.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> 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