Go to the source code of this file.
Data Structures | |
struct | xta_xa_resource_s |
Typedefs | |
typedef struct xta_transaction_s | xta_transaction_t |
typedef struct act_rsrmgr_config_s | xta_xa_resource_config_t |
typedef struct xta_xa_resource_s | xta_xa_resource_t |
Functions | |
void | xta_xa_resource_clean (xta_xa_resource_t *xa_resource) |
int | xta_xa_resource_commit (xta_xa_resource_t *xa_resource, const xta_xid_t *xid, int one_phase) |
int | xta_xa_resource_end (xta_xa_resource_t *xa_resource, const xta_xid_t *xid, long flag) |
int | xta_xa_resource_enlisted (xta_xa_resource_t *xa_resource, const xta_transaction_t *tx) |
const xta_xa_resource_config_t * | xta_xa_resource_get_config (const xta_xa_resource_t *xa_resource) |
int | xta_xa_resource_init (xta_xa_resource_t *xa_resource, int native) |
static int | xta_xa_resource_is_dynamic (const xta_xa_resource_t *xa_resource) |
static int | xta_xa_resource_is_native (const xta_xa_resource_t *xa_resource) |
int | xta_xa_resource_prepare (xta_xa_resource_t *xa_resource, const xta_xid_t *xid) |
int | xta_xa_resource_start (xta_xa_resource_t *xa_resource, const xta_xid_t *xid, long flag) |
typedef struct xta_transaction_s xta_transaction_t |
This type is a declaration only statement: the real type is defined inside Transaction header file. Here we just need to store a pointer to a Transaction inside an XA Resource.
Definition at line 36 of file xta_xa_resource.h.
typedef struct act_rsrmgr_config_s xta_xa_resource_config_t |
This type is just a redefinition of the legacy LIXA struct "act_rsrmgr_config_s" to avoid a type with a "strange name" in the API
Definition at line 44 of file xta_xa_resource.h.
typedef struct xta_xa_resource_s xta_xa_resource_t |
The base "class" xta_xa_resource is just a redefinition of the standard xa_switch_t structure as defined by X/Open
Inheritance is emulated using the schema proposed by Martin in this post: http://stackoverflow.com/questions/1114349/struct-inheritance-in-c .
Using -fms-extensions the result would be better, but less portable.
Using -std=c11 the result does not improve because a "tag" (like a struct is not allowed as explained here: https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html )
void xta_xa_resource_clean | ( | xta_xa_resource_t * | xa_resource | ) |
Clean the properties of a XA Resource; this function must be called after xta_xa_resource_init during object disposition to avoid memory leaks
[in,out] | xa_resource | : XA Resource object |
Definition at line 184 of file xta_xa_resource.c.
References LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, and LIXA_RC_OK.
Referenced by xta_native_xa_resource_clean().
int xta_xa_resource_commit | ( | xta_xa_resource_t * | xa_resource, |
const xta_xid_t * | xid, | ||
int | one_phase | ||
) |
Commits the global transaction specified by xid.
[in,out] | xa_resource | : resource object |
[in] | xid | : transaction identifier object |
[in] | one_phase | : if true, the resource manager should use a one-phase commit protocol to commit the work done on behalf of xid |
Definition at line 296 of file xta_xa_resource.c.
References LIXA_RC_INTERNAL_ERROR, and LIXA_RC_OK.
int xta_xa_resource_end | ( | xta_xa_resource_t * | xa_resource, |
const xta_xid_t * | xid, | ||
long | flag | ||
) |
Ends the work performed on behalf of a transaction branch. The resource manager disassociates the XA resource from the transaction branch specified and lets the transaction complete. If TMSUSPEND is specified in the flags, the transaction branch is temporarily suspended in an incomplete state. The transaction context is in a suspended state and must be resumed via the start method with TMRESUME specified. If TMFAIL is specified, the portion of work has failed. The resource manager may mark the transaction as rollback-only. If TMSUCCESS is specified, the portion of work has completed successfully.
[in,out] | xa_resource | : resource object |
[in] | xid | : transaction identifier object |
[in] | flag | : one of TMSUCCESS, TMFAIL, or TMSUSPEND |
Definition at line 243 of file xta_xa_resource.c.
References LIXA_RC_INTERNAL_ERROR, and LIXA_RC_OK.
int xta_xa_resource_enlisted | ( | xta_xa_resource_t * | xa_resource, |
const xta_transaction_t * | tx | ||
) |
This call back method is invoked by a Transaction Manager when an Application Program enlists an XA Resource to a Transaction Manager. The TM calls back the XA Resource to notify it has been registered.
[in,out] | xa_resource | : XA Resource object |
[in] | tx | : XA Transaction |
Definition at line 127 of file xta_xa_resource.c.
References xta_xa_resource_s::enlisted_tx, LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, and LIXA_RC_RESOURCE_ALREADY_REGISTERED.
Referenced by xta_transaction_enlist_resource().
const xta_xa_resource_config_t* xta_xa_resource_get_config | ( | const xta_xa_resource_t * | xa_resource | ) |
Return a reference (a pointer) to the configuration parameters of the resource.
[in] | xa_resource | : XA Resource object |
Definition at line 90 of file xta_xa_resource.c.
References xta_xa_resource_s::act_rsrmgr_config, LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, and LIXA_RC_OK.
Referenced by xta_transaction_enlist_resource().
int xta_xa_resource_init | ( | xta_xa_resource_t * | xa_resource, |
int | native | ||
) |
Initialize the common properties of XA Resources
[in,out] | xa_resource | : XA Resource object |
[in] | native | : TRUE, the XA Resource uses an XA native interface FALSE, the XA Resource uses an XTA interface |
Definition at line 46 of file xta_xa_resource.c.
References xta_xa_resource_s::act_rsrmgr_config, xta_xa_resource_s::dynamic, xta_xa_resource_s::enlisted_tx, lixa_iface_reset(), LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, and xta_xa_resource_s::rsrmgr_config.
Referenced by xta_acquired_xa_resource_init(), and xta_native_xa_resource_init().
|
inlinestatic |
Check if the XA Resource has been created dynamically or not
[in] | xa_resource | : XA Resource object |
Definition at line 135 of file xta_xa_resource.h.
References xta_xa_resource_s::dynamic.
Referenced by xta_transaction_enlist_resource().
|
inlinestatic |
Check if the XA Resouce uses a native XA interface or not
[in] | xa_resource | : XA Resource object |
Definition at line 145 of file xta_xa_resource.h.
References xta_xa_resource_s::native.
int xta_xa_resource_prepare | ( | xta_xa_resource_t * | xa_resource, |
const xta_xid_t * | xid | ||
) |
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
[in,out] | xa_resource | : resource object |
[in] | xid | : transaction identifier object |
Definition at line 270 of file xta_xa_resource.c.
References LIXA_RC_INTERNAL_ERROR, and LIXA_RC_OK.
int xta_xa_resource_start | ( | xta_xa_resource_t * | xa_resource, |
const xta_xid_t * | xid, | ||
long | flag | ||
) |
Starts work on behalf of a transaction branch specified in xid. If TMJOIN is specified, the start applies to joining a transaction previously seen by the resource manager. If TMRESUME is specified, the start applies to resuming a suspended transaction specified in the parameter xid.
[in,out] | xa_resource | : resource object |
[in] | xid | : transaction identifier object |
[in] | flag | : one of TMNOFLAGS, TMJOIN, or TMRESUME |
Definition at line 216 of file xta_xa_resource.c.
References LIXA_RC_INTERNAL_ERROR, and LIXA_RC_OK.