XTA: API Reference for C language

xta_transaction.c File Reference
#include "config.h"
#include "lixa_errors.h"
#include "lixa_trace.h"
#include "client_conn.h"
#include "client_config.h"
#include "client_status.h"
#include "lixa_xa.h"
#include "lixa_syslog.h"
#include "xta_transaction.h"
Include dependency graph for xta_transaction.c:

Go to the source code of this file.

Macros

#define LIXA_TRACE_MODULE   LIXA_TRACE_MOD_XTA
 

Functions

int xta_transaction_branch (xta_transaction_t *transact, const char *xid_string)
 
int xta_transaction_close (xta_transaction_t *transact)
 
int xta_transaction_close_internal (xta_transaction_t *transact)
 
int xta_transaction_commit (xta_transaction_t *transact, int non_blocking)
 
void xta_transaction_delete (xta_transaction_t *transact)
 
int xta_transaction_enlist_resource (xta_transaction_t *transact, xta_xa_resource_t *xa_res)
 
xta_config_txta_transaction_get_config (xta_transaction_t *transact)
 
int xta_transaction_get_multiple_branches (const xta_transaction_t *transact)
 
const xta_xid_txta_transaction_get_xid (const xta_transaction_t *transact)
 
xta_transaction_txta_transaction_new (void)
 
int xta_transaction_open (xta_transaction_t *transact)
 
int xta_transaction_open_internal (xta_transaction_t *transact)
 
int xta_transaction_recover (xta_transaction_t *transact)
 
int xta_transaction_redigest (xta_transaction_t *transact, const xta_xa_resource_config_t *xrc)
 
int xta_transaction_resume (xta_transaction_t *transact, const char *xid_string, long flags)
 
int xta_transaction_rollback (xta_transaction_t *transact)
 
int xta_transaction_safe_delete (const xta_transaction_t *transact)
 
int xta_transaction_start (xta_transaction_t *transact, int multiple_branches)
 
int xta_transaction_suspend (xta_transaction_t *transact, long flags)
 

Macro Definition Documentation

#define LIXA_TRACE_MODULE   LIXA_TRACE_MOD_XTA

Definition at line 50 of file xta_transaction.c.

Function Documentation

int xta_transaction_branch ( xta_transaction_t transact,
const char *  xid_string 
)

Create a new branch of the transaction represented by xid in this transaction object; the global transaction has been previously started

Parameters
[in,out]transact: transaction object
[in]xid_stringserialized identifier of the global transaction that must be branched
Returns
a reason code

Definition at line 1390 of file xta_transaction.c.

References xta_transaction_s::already_opened, xta_transaction_s::client_status, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_STATUS, LIXA_RC_MALFORMED_XID, LIXA_RC_NO_SUPERIOR_BRANCH, LIXA_RC_NON_BRANCHABLE_TX, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, xta_transaction_s::local_ccc, TMXTABRANCH, xta_transaction_s::xid, xta_transaction_open_internal(), xta_xid_branch_qualifier_is_multibranch(), xta_xid_get_xa_xid(), and xta_xid_new_from_XID().

int xta_transaction_close ( xta_transaction_t transact)
Deprecated:

Definition at line 626 of file xta_transaction.c.

References xta_transaction_close_internal().

int xta_transaction_commit ( xta_transaction_t transact,
int  non_blocking 
)

Commit the transaction represented by this transaction object

Parameters
[in,out]transact: transaction object
[in]non_blockingboolean value:
TRUE = xa_prepare will not block the caller
FALSE = xa_prepare will block the caller
the option is used only for multiple branch transactions
Returns
a reason code

Definition at line 838 of file xta_transaction.c.

References xta_transaction_s::client_status, xta_transaction_s::commit_suspended, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_STATUS, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, LIXA_RC_OTHER_BRANCH_ERROR, LIXA_RC_TX_HAZARD, LIXA_RC_TX_MIXED, LIXA_RC_TX_ROLLBACK, LIXA_RC_WOULD_BLOCK, xta_transaction_s::local_ccc, TMSUCCESS, xta_transaction_s::xid, xta_xid_branch_qualifier_is_multibranch(), xta_xid_get_xa_xid(), and xta_xid_reset().

void xta_transaction_delete ( xta_transaction_t transact)

Delete a Transaction object

Parameters
[in]transact: transaction object to delete
Deprecated:
only xta_transaction_manager_delete should call this function. If arbitrarily called, segmentation fault due to double free of the same pointer can happen.

Definition at line 184 of file xta_transaction.c.

References xta_transaction_s::already_opened, xta_transaction_s::client_status, LIXA_RC_INTERNAL_ERROR, LIXA_RC_OK, xta_transaction_s::local_ccc, xta_transaction_s::xid, xta_transaction_close_internal(), and xta_xid_delete().

Referenced by xta_transaction_manager_create_transaction().

int xta_transaction_enlist_resource ( xta_transaction_t transact,
xta_xa_resource_t xa_res 
)

Enlist the resource specified with the Transaction associated with the Transaction object

Parameters
[in,out]transact: transaction object
[in]xa_res: resource to associate
Returns
a reason code

Definition at line 340 of file xta_transaction.c.

References xta_transaction_s::client_status, LIXA_RC_G_TRY_MALLOC_ERROR, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_STATUS, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, xta_transaction_s::local_ccc, xta_transaction_redigest(), xta_xa_resource_enlisted(), xta_xa_resource_get_config(), and xta_xa_resource_is_dynamic().

xta_config_t* xta_transaction_get_config ( xta_transaction_t transact)

Get a reference to the configuration that applies to this transaction object, like all the define Resource Managers

Parameters
[in]transact: Transaction object
Returns
the pointer to the Transaction configuration object

Definition at line 307 of file xta_transaction.c.

References LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, and xta_transaction_s::local_ccc.

int xta_transaction_get_multiple_branches ( const xta_transaction_t transact)

Get the flag multiple_branches

Parameters
[in]transact: transaction object
Returns
multiple_branches flag

Definition at line 1556 of file xta_transaction.c.

References LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, and xta_transaction_s::multiple_branches.

Referenced by xta_transaction_manager_create_transaction().

const xta_xid_t* xta_transaction_get_xid ( const xta_transaction_t transact)

Get the Xid associated with the Transaction object

Parameters
[in]transact: transaction object
Returns
a reference to the Transaction Identifier

Definition at line 1523 of file xta_transaction.c.

References LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, and xta_transaction_s::xid.

xta_transaction_t* xta_transaction_new ( void  )

Create a new Transaction object

Returns
a new transaction object or NULL in the event of an error occurred

Definition at line 54 of file xta_transaction.c.

References LIXA_RC_G_TRY_MALLOC_ERROR, LIXA_RC_INTERNAL_ERROR, LIXA_RC_OK, and lixa_strerror().

Referenced by xta_transaction_manager_create_transaction().

int xta_transaction_open ( xta_transaction_t transact)
Deprecated:

Definition at line 553 of file xta_transaction.c.

References xta_transaction_open_internal().

int xta_transaction_recover ( xta_transaction_t transact)

Explicitly open and close all the enlisted resource to look for recovery pending transaction in the LIXA state server. In normal condition, this is not necessary, because the same happens when xta_transaction_start, xta_transaction_resume and xta_transaction_branch are called

Parameters
[in,out]transact: transaction object
Returns
a reason code

Definition at line 709 of file xta_transaction.c.

References LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, xta_transaction_close_internal(), and xta_transaction_open_internal().

int xta_transaction_redigest ( xta_transaction_t transact,
const xta_xa_resource_config_t xrc 
)

When a resource registers dynamically the digest must be updated because the configuration has been altered. This must be considered a PRIVATE method and should not be used by the Application Program.

Parameters
[in,out]transact: transaction object
[in]xrc: XA resource configuration (LIXA legacy structure)
Returns
a reason code

Definition at line 451 of file xta_transaction.c.

References xta_transaction_s::client_status, lixa_job_get_raw(), lixa_job_reset(), lixa_job_set_config_digest(), lixa_job_set_source_ip(), LIXA_RC_G_CHECKSUM_GET_STRING_ERROR, LIXA_RC_G_CHECKSUM_NEW_ERROR, LIXA_RC_INTERNAL_ERROR, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, xta_transaction_s::local_ccc, and MD5_DIGEST_LENGTH.

Referenced by xta_transaction_enlist_resource().

int xta_transaction_resume ( xta_transaction_t transact,
const char *  xid_string,
long  flags 
)

Resume the transaction represented by xid in this transaction object; the transaction has been previously suspended with xta_transaction_suspend

Parameters
[in,out]transacttransaction object
[in]xid_stringserialized identifier of the transaction that must be resumed (see xta_xid_to_string)
[in]flagscan be TMRESUME if the transaction has been suspended using TMMIGRATE or TMJOIN if the transaction has been suspended using TMNOFLAGS
Returns
a reason code

Definition at line 1290 of file xta_transaction.c.

References xta_transaction_s::already_opened, xta_transaction_s::client_status, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_OPTION, LIXA_RC_INVALID_STATUS, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, LIXA_RC_PROTOCOL_ERROR, xta_transaction_s::local_ccc, TMJOIN, TMRESUME, xta_transaction_s::xid, xta_transaction_open_internal(), xta_xid_get_xa_xid(), and xta_xid_new_from_string().

int xta_transaction_rollback ( xta_transaction_t transact)

Rollback the transaction represented by this transaction object

Parameters
[in,out]transact: transaction object
Returns
a reason code

Definition at line 1092 of file xta_transaction.c.

References xta_transaction_s::client_status, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_STATUS, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, LIXA_RC_TX_HAZARD, LIXA_RC_TX_MIXED, xta_transaction_s::local_ccc, TMSUCCESS, xta_transaction_s::xid, xta_xid_get_xa_xid(), and xta_xid_reset().

int xta_transaction_safe_delete ( const xta_transaction_t transact)

Check if the transaction object can be safely deleted: if there's a transaction in progress, this method returns FALSE

Parameters
[in]transact: transaction object to delete
Returns
a boolean value

Definition at line 244 of file xta_transaction.c.

References xta_transaction_s::client_status, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_STATUS, LIXA_RC_NULL_OBJECT, and LIXA_RC_OK.

Referenced by xta_transaction_manager_create_transaction().

int xta_transaction_start ( xta_transaction_t transact,
int  multiple_branches 
)

Start a new XA Transaction. From the XA specification point of view, it calls xa_start (for the Native XA Resource Managers)

Parameters
[in,out]transact: transaction object
[in]multiple_branches: boolean value:
TRUE = the created transaction will span more applications, xta_transaction_branch will be called subsequently
FALSE = the created transaction will not span more applications and xta_transaction_branch will not be called for this transaction
Returns
a reason code

Definition at line 752 of file xta_transaction.c.

References xta_transaction_s::already_opened, xta_transaction_s::client_status, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_STATUS, LIXA_RC_NON_REUSABLE_TX, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, xta_transaction_s::local_ccc, xta_transaction_s::multiple_branches, TMNOFLAGS, xta_transaction_s::xid, xta_transaction_open_internal(), xta_xid_get_xa_xid(), and xta_xid_new().

int xta_transaction_suspend ( xta_transaction_t transact,
long  flags 
)

Suspend the transaction represented by this transaction object; the transaction can be resumed with xta_transaction_resume at a later time

Parameters
[in,out]transact: transaction object
[in]flagscan be TMMIGRATE if the Resource Manager supports transaction migration and TMNOFLAGS otherwise
Returns
a reason code

Definition at line 1209 of file xta_transaction.c.

References xta_transaction_s::client_status, LIXA_RC_INTERNAL_ERROR, LIXA_RC_INVALID_OPTION, LIXA_RC_INVALID_STATUS, LIXA_RC_NULL_OBJECT, LIXA_RC_OK, LIXA_RC_PROTOCOL_ERROR, xta_transaction_s::local_ccc, TMMIGRATE, TMNOFLAGS, TMSUSPEND, xta_transaction_s::xid, and xta_xid_get_xa_xid().


Copyright © 2009-2019, Christian Ferrari tiian@users.sourceforge.net http://www.tiian.org/