On Fri, Jul 10, 2015 at 11:46:43AM +0800, Fam Zheng wrote:
> They will be called if the job is part of a transaction, after all jobs in a
> transaction are completed or cancelled, before calling job->cb().
> 
> Signed-off-by: Fam Zheng <f...@redhat.com>
> ---
>  include/block/blockjob.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/block/blockjob.h b/include/block/blockjob.h
> index dd9d5e6..a7b7f66 100644
> --- a/include/block/blockjob.h
> +++ b/include/block/blockjob.h
> @@ -50,6 +50,18 @@ typedef struct BlockJobDriver {
>       * manually.
>       */
>      void (*complete)(BlockJob *job, Error **errp);
> +
> +    /**
> +     * Optional callback for job types that can be in a transaction. Called
> +     * when the transaction succeeds.
> +     */
> +    void (*txn_commit)(BlockJob *job);
> +
> +    /**
> +     * Optional callback for job types that can be in a transaction. Call 
> when
> +     * the transaction fails.
> +     */
> +    void (*txn_abort)(BlockJob *job);
>  } BlockJobDriver;

The semantics of transactions aren't fully documented.  My understanding
is that you want:
1. either .txn_commit() or .txn_abort() to be called
2. after all jobs complete (due to success, error, or cancellation).

These two points are important for understanding these interfaces.

Attachment: pgpbPG79d3b0w.pgp
Description: PGP signature

Reply via email to