XTA: API Reference for C language

xta_postgresql_xa_resource.h File Reference
#include <libpq-fe.h>
#include "xta_acquired_xa_resource.h"
#include "lixa_sw.h"
Include dependency graph for xta_postgresql_xa_resource.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  xta_postgresql_xa_resource_t
 

Macros

#define LIXA_TRACE_MODULE   LIXA_TRACE_MOD_XTA
 

Functions

int xta_postgresql_xa_close (xta_xa_resource_t *context, char *xa_info, int rmid, long flags)
 
int xta_postgresql_xa_commit (xta_xa_resource_t *context, const XID *xid, int rmid, long flags)
 
int xta_postgresql_xa_end (xta_xa_resource_t *context, const XID *xid, int rmid, long flags)
 
int xta_postgresql_xa_forget (xta_xa_resource_t *context, const XID *xid, int rmid, long flags)
 
int xta_postgresql_xa_open (xta_xa_resource_t *context, char *xa_info, int rmid, long flags)
 
int xta_postgresql_xa_prepare (xta_xa_resource_t *context, const XID *xid, int rmid, long flags)
 
int xta_postgresql_xa_recover (xta_xa_resource_t *context, XID *xids, long count, int rmid, long flags)
 
void xta_postgresql_xa_resource_clean (xta_postgresql_xa_resource_t *xa_resource)
 
void xta_postgresql_xa_resource_delete (xta_postgresql_xa_resource_t *xa_resource)
 
int xta_postgresql_xa_resource_init (xta_postgresql_xa_resource_t *xa_resource, PGconn *connection, const char *name, const char *open_info)
 
xta_postgresql_xa_resource_txta_postgresql_xa_resource_new (PGconn *connection, const char *name, const char *open_info)
 
int xta_postgresql_xa_rollback (xta_xa_resource_t *context, const XID *xid, int rmid, long flags)
 
int xta_postgresql_xa_start (xta_xa_resource_t *context, const XID *xid, int rmid, long flags)
 

Macro Definition Documentation

#define LIXA_TRACE_MODULE   LIXA_TRACE_MOD_XTA

Definition at line 40 of file xta_postgresql_xa_resource.h.

Function Documentation

int xta_postgresql_xa_close ( xta_xa_resource_t context,
char *  xa_info,
int  rmid,
long  flags 
)

Close a Postgresql resource manager

Parameters
[in,out]context: XTA resource context
[in]xa_info: null-terminated character string that may contain instance-specific information for the resource manager
[in]rmid: an integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flags: TMNOFLAGS, future usage only
Returns
a XA return code

Definition at line 260 of file xta_postgresql_xa_resource.c.

References XA_OK, and XAER_RMERR.

int xta_postgresql_xa_commit ( xta_xa_resource_t context,
const XID xid,
int  rmid,
long  flags 
)

Commit work done on behalf of a transaction branch

Parameters
[in,out]context: XTA resource context
[in]xidtransaction identifier, XA spec
[in]rmid: an integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flags: TMONEPHASE or TMNOFLAGS
Returns
a XA return code

Definition at line 449 of file xta_postgresql_xa_resource.c.

References XAER_RMERR.

int xta_postgresql_xa_end ( xta_xa_resource_t context,
const XID xid,
int  rmid,
long  flags 
)

End work performed on behalf of a transaction branch

Parameters
[in,out]contextXTA resource context
[in]xidtransaction identifier, XA spec
[in]rmidan integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flagsonly TMSUCCESS and TMFAIL can be passed to a Postgresql resource
Returns
a XA return code

Definition at line 337 of file xta_postgresql_xa_resource.c.

References XAER_RMERR.

int xta_postgresql_xa_forget ( xta_xa_resource_t context,
const XID xid,
int  rmid,
long  flags 
)

Forget about a heuristically completed transaction branch

Parameters
[in,out]context: XTA resource context
[in]xidtransaction identifier, XA spec
[in]rmid: an integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flags: TMNOFLAGS, future usage only
Returns
a XA return code

Definition at line 523 of file xta_postgresql_xa_resource.c.

References XAER_RMERR.

int xta_postgresql_xa_open ( xta_xa_resource_t context,
char *  xa_info,
int  rmid,
long  flags 
)

Open a PostgreSQL resource manager

Parameters
[in,out]context: XTA resource context
[in]xa_info: null-terminated character string that may contain instance-specific information for the resource manager
[in]rmid: an integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flags: TMNOFLAGS, future usage only
Returns
a XA return code

Definition at line 215 of file xta_postgresql_xa_resource.c.

References XA_OK, and XAER_RMERR.

int xta_postgresql_xa_prepare ( xta_xa_resource_t context,
const XID xid,
int  rmid,
long  flags 
)

Prepare to commit work done on behalf of a transaction branch

Parameters
[in,out]context: XTA resource context
[in]xidtransaction identifier, XA spec
[in]rmid: an integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flags: TMNOFLAGS, future usage only
Returns
a XA return code

Definition at line 412 of file xta_postgresql_xa_resource.c.

References XAER_RMERR.

int xta_postgresql_xa_recover ( xta_xa_resource_t context,
XID xids,
long  count,
int  rmid,
long  flags 
)

Obtain a list of prepared transaction branches from a resource manager

Parameters
[in,out]context: XTA resource context
[in]xids: an array into which the resource manager places XIDs for list of transaction branches that are currently in a prepared or heuristically completed state
[in]count: the maximum number of XIDs that fit into that array
[in]rmid: an integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flags: TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS
Returns
a XA return code

Definition at line 486 of file xta_postgresql_xa_resource.c.

References XAER_RMERR.

void xta_postgresql_xa_resource_clean ( xta_postgresql_xa_resource_t xa_resource)

Clean the properties of a PostgreSQL XA Resource; this function must be called after xta_postgresql_xa_resource_init during object deletion to avoid memory leaks

Parameters
[in,out]xa_resource: PostgreSQL XA Resource object

Definition at line 185 of file xta_postgresql_xa_resource.c.

References xta_xa_resource_s::act_rsrmgr_config, LIXA_RC_INTERNAL_ERROR, LIXA_RC_OK, xta_postgresql_xa_resource_t::xa_resource, and xta_acquired_xa_resource_clean().

Referenced by xta_postgresql_xa_resource_delete().

void xta_postgresql_xa_resource_delete ( xta_postgresql_xa_resource_t xa_resource)

Delete an object that represent a PostgreSQL XA Resource

Parameters
[in]xa_resource: PostgreSQL XA Resource

Definition at line 111 of file xta_postgresql_xa_resource.c.

References LIXA_RC_INTERNAL_ERROR, LIXA_RC_OK, and xta_postgresql_xa_resource_clean().

int xta_postgresql_xa_resource_init ( xta_postgresql_xa_resource_t xa_resource,
PGconn *  connection,
const char *  name,
const char *  open_info 
)

Initialize the propeties of a PostgreSQL XA resource

Parameters
[in,out]xa_resource: PostgreSQL XA Resource object
[in]connection: to PostgreSQL already opened by the application program
[in]name: unique identifier of the resource
[in]open_info: unique description of the connection properties like network name/IP address, port, user/schema, etc. Only the first MAXINFOSIZE characters will be kept.
Returns
a new object or NULL in the event of error

Definition at line 141 of file xta_postgresql_xa_resource.c.

References xta_xa_resource_s::act_rsrmgr_config, xta_postgresql_xa_resource_t::connection, lixa_iface_set_xta(), LIXA_RC_INTERNAL_ERROR, LIXA_RC_OK, xta_postgresql_xa_resource_t::lssr, xta_postgresql_xa_resource_t::xa_resource, and xta_acquired_xa_resource_init().

Referenced by xta_postgresql_xa_resource_new().

xta_postgresql_xa_resource_t* xta_postgresql_xa_resource_new ( PGconn *  connection,
const char *  name,
const char *  open_info 
)

Create a new object to represent a PostgreSQL XA resource

Parameters
[in,out]connectionto PostgreSQL already opened by the application program
[in]name: unique identifier of the resource
[in]open_info: unique description of the connection properties like network name/IP address, port, user/schema, etc. Only the first MAXINFOSIZE characters will be kept.
Returns
a new object or NULL in the event of error

Definition at line 69 of file xta_postgresql_xa_resource.c.

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

int xta_postgresql_xa_rollback ( xta_xa_resource_t context,
const XID xid,
int  rmid,
long  flags 
)

Roll back work done on behalf of a transaction branch

Parameters
[in,out]context: XTA resource context
[in]xidtransaction identifier, XA spec
[in]rmid: an integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flags: TMNOFLAGS, future usage only
Returns
a XA return code

Definition at line 375 of file xta_postgresql_xa_resource.c.

References XAER_RMERR.

int xta_postgresql_xa_start ( xta_xa_resource_t context,
const XID xid,
int  rmid,
long  flags 
)

Start work on behalf of a transaction branch

Parameters
[in,out]contextXTA resource context
[in]xidtransaction identifier, XA spec
[in]rmidan integer assigned by the transaction manager, uniquely identifies the called resource manager instance within the thread of control
[in]flagsonly TMNOFLAGS can be passed to a Postgresql resource
Returns
a XA return code

Definition at line 300 of file xta_postgresql_xa_resource.c.

References XAER_RMERR.


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