xa.h

Go to the documentation of this file.
00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1998, 1999, 2000
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: xa_8h-source.html,v 1.1 2008/06/08 10:25:43 sebdiaz Exp $
00008  */
00009 /*
00010  * Start of xa.h header
00011  *
00012  * Define a symbol to prevent multiple inclusions of this header file
00013  */
00014 #ifndef XA_H
00015 #define XA_H
00016 
00017 /*
00018  * Transaction branch identification: XID and NULLXID:
00019  */
00020 #define XIDDATASIZE     128             /* size in bytes */
00021 #define MAXGTRIDSIZE     64             /* maximum size in bytes of gtrid */
00022 #define MAXBQUALSIZE     64             /* maximum size in bytes of bqual */
00023 
00024 struct xid_t {
00025         long formatID;                  /* format identifier */
00026         long gtrid_length;              /* value from 1 through 64 */
00027         long bqual_length;              /* value from 1 through 64 */
00028         char data[XIDDATASIZE];
00029 };
00030 typedef struct xid_t XID;
00031 /*
00032  * A value of -1 in formatID means that the XID is null.
00033  */
00034 
00035 /*
00036  * Declarations of routines by which RMs call TMs:
00037  */
00038 extern int ax_reg __P((int, XID *, long));
00039 extern int ax_unreg __P((int, long));
00040 
00041 /*
00042  * XA Switch Data Structure
00043  */
00044 #define RMNAMESZ        32              /* length of resource manager name, */
00045                                         /* including the null terminator */
00046 #define MAXINFOSIZE     256             /* maximum size in bytes of xa_info */
00047                                         /* strings, including the null
00048                                         terminator */
00049 struct xa_switch_t {
00050         char name[RMNAMESZ];            /* name of resource manager */
00051         long flags;                     /* resource manager specific options */
00052         long version;                   /* must be 0 */
00053         int (*xa_open_entry)            /* xa_open function pointer */
00054             __P((char *, int, long));
00055         int (*xa_close_entry)           /* xa_close function pointer */
00056             __P((char *, int, long));
00057         int (*xa_start_entry)           /* xa_start function pointer */
00058             __P((XID *, int, long));
00059         int (*xa_end_entry)             /* xa_end function pointer */
00060             __P((XID *, int, long));
00061         int (*xa_rollback_entry)        /* xa_rollback function pointer */
00062             __P((XID *, int, long));
00063         int (*xa_prepare_entry)         /* xa_prepare function pointer */
00064             __P((XID *, int, long));
00065         int (*xa_commit_entry)          /* xa_commit function pointer */
00066             __P((XID *, int, long));
00067         int (*xa_recover_entry)         /* xa_recover function pointer */
00068             __P((XID *, long, int, long));
00069         int (*xa_forget_entry)          /* xa_forget function pointer */
00070             __P((XID *, int, long));
00071         int (*xa_complete_entry)        /* xa_complete function pointer */
00072             __P((int *, int *, int, long));
00073 };
00074 
00075 /*
00076  * Flag definitions for the RM switch
00077  */
00078 #define TMNOFLAGS       0x00000000L     /* no resource manager features
00079                                         selected */
00080 #define TMREGISTER      0x00000001L     /* resource manager dynamically
00081                                         registers */
00082 #define TMNOMIGRATE     0x00000002L     /* resource manager does not support
00083                                         association migration */
00084 #define TMUSEASYNC      0x00000004L     /* resource manager supports
00085                                         asynchronous operations */
00086 /*
00087  * Flag definitions for xa_ and ax_ routines
00088  */
00089 /* use TMNOFLAGGS, defined above, when not specifying other flags */
00090 #define TMASYNC         0x80000000L     /* perform routine asynchronously */
00091 #define TMONEPHASE      0x40000000L     /* caller is using one-phase commit
00092                                         optimisation */
00093 #define TMFAIL          0x20000000L     /* dissociates caller and marks
00094                                         transaction branch rollback-only */
00095 #define TMNOWAIT        0x10000000L     /* return if blocking condition
00096                                         exists */
00097 #define TMRESUME        0x08000000L     /* caller is resuming association with
00098                                         suspended transaction branch */
00099 #define TMSUCCESS       0x04000000L     /* dissociate caller from transaction
00100                                         branch */
00101 #define TMSUSPEND       0x02000000L     /* caller is suspending, not ending,
00102                                         association */
00103 #define TMSTARTRSCAN    0x01000000L     /* start a recovery scan */
00104 #define TMENDRSCAN      0x00800000L     /* end a recovery scan */
00105 #define TMMULTIPLE      0x00400000L     /* wait for any asynchronous
00106                                         operation */
00107 #define TMJOIN          0x00200000L     /* caller is joining existing
00108                                         transaction branch */
00109 #define TMMIGRATE       0x00100000L     /* caller intends to perform
00110                                         migration */
00111 
00112 /*
00113  * ax_() return codes (transaction manager reports to resource manager)
00114  */
00115 #define TM_JOIN         2               /* caller is joining existing
00116                                         transaction branch */
00117 #define TM_RESUME       1               /* caller is resuming association with
00118                                         suspended transaction branch */
00119 #define TM_OK           0               /* normal execution */
00120 #define TMER_TMERR      -1              /* an error occurred in the transaction
00121                                         manager */
00122 #define TMER_INVAL      -2              /* invalid arguments were given */
00123 #define TMER_PROTO      -3              /* routine invoked in an improper
00124                                         context */
00125 
00126 /*
00127  * xa_() return codes (resource manager reports to transaction manager)
00128  */
00129 #define XA_RBBASE       100             /* The inclusive lower bound of the
00130                                         rollback codes */
00131 #define XA_RBROLLBACK   XA_RBBASE       /* The rollback was caused by an
00132                                         unspecified reason */
00133 #define XA_RBCOMMFAIL   XA_RBBASE+1     /* The rollback was caused by a
00134                                         communication failure */
00135 #define XA_RBDEADLOCK   XA_RBBASE+2     /* A deadlock was detected */
00136 #define XA_RBINTEGRITY  XA_RBBASE+3     /* A condition that violates the
00137                                         integrity of the resources was
00138                                         detected */
00139 #define XA_RBOTHER      XA_RBBASE+4     /* The resource manager rolled back the
00140                                         transaction branch for a reason not
00141                                         on this list */
00142 #define XA_RBPROTO      XA_RBBASE+5     /* A protocol error occurred in the
00143                                         resource manager */
00144 #define XA_RBTIMEOUT    XA_RBBASE+6     /* A transaction branch took too long */
00145 #define XA_RBTRANSIENT  XA_RBBASE+7     /* May retry the transaction branch */
00146 #define XA_RBEND        XA_RBTRANSIENT  /* The inclusive upper bound of the
00147                                         rollback codes */
00148 #define XA_NOMIGRATE    9               /* resumption must occur where
00149                                         suspension occurred */
00150 #define XA_HEURHAZ      8               /* the transaction branch may have
00151                                         been heuristically completed */
00152 #define XA_HEURCOM      7               /* the transaction branch has been
00153                                         heuristically committed */
00154 #define XA_HEURRB       6               /* the transaction branch has been
00155                                         heuristically rolled back */
00156 #define XA_HEURMIX      5               /* the transaction branch has been
00157                                         heuristically committed and rolled
00158                                         back */
00159 #define XA_RETRY        4               /* routine returned with no effect and
00160                                         may be re-issued */
00161 #define XA_RDONLY       3               /* the transaction branch was read-only
00162                                         and has been committed */
00163 #define XA_OK           0               /* normal execution */
00164 #define XAER_ASYNC      -2              /* asynchronous operation already
00165                                         outstanding */
00166 #define XAER_RMERR      -3              /* a resource manager error occurred in
00167                                          the transaction branch */
00168 #define XAER_NOTA       -4              /* the XID is not valid */
00169 #define XAER_INVAL      -5              /* invalid arguments were given */
00170 #define XAER_PROTO      -6              /* routine invoked in an improper
00171                                         context */
00172 #define XAER_RMFAIL     -7              /* resource manager unavailable */
00173 #define XAER_DUPID      -8              /* the XID already exists */
00174 #define XAER_OUTSIDE    -9              /* resource manager doing work outside
00175                                         transaction */
00176 #endif /* ifndef XA_H */
00177 /*
00178  * End of xa.h header
00179  */

Generated on Sun Jun 8 10:56:39 2008 for GNUmifluz by  doxygen 1.5.5