mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / innobase / include / trx0xa.h
blobdf85cd663cb12f4485aa3269927edaeb8988582c
1 /*
2 * Start of xa.h header
4 * Define a symbol to prevent multiple inclusions of this header file
5 */
6 #ifndef XA_H
7 #define XA_H
9 /*
10 * Transaction branch identification: XID and NULLXID:
12 #ifndef XIDDATASIZE
14 #define XIDDATASIZE 128 /* size in bytes */
15 #define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */
16 #define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */
18 struct xid_t {
19 long formatID; /* format identifier */
20 long gtrid_length; /* value from 1 through 64 */
21 long bqual_length; /* value from 1 through 64 */
22 char data[XIDDATASIZE];
24 typedef struct xid_t XID;
25 #endif
27 * A value of -1 in formatID means that the XID is null.
31 #ifdef NOTDEFINED
32 /* Let us comment this out to remove compiler errors!!!!!!!!!!!! */
35 * Declarations of routines by which RMs call TMs:
37 extern int ax_reg __P((int, XID *, long));
38 extern int ax_unreg __P((int, long));
41 * XA Switch Data Structure
43 #define RMNAMESZ 32 /* length of resource manager name, */
44 /* including the null terminator */
45 #define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */
46 /* strings, including the null
47 terminator */
50 struct xa_switch_t {
51 char name[RMNAMESZ]; /* name of resource manager */
52 long flags; /* resource manager specific options */
53 long version; /* must be 0 */
54 int (*xa_open_entry) /* xa_open function pointer */
55 __P((char *, int, long));
56 int (*xa_close_entry) /* xa_close function pointer */
57 __P((char *, int, long));
58 int (*xa_start_entry) /* xa_start function pointer */
59 __P((XID *, int, long));
60 int (*xa_end_entry) /* xa_end function pointer */
61 __P((XID *, int, long));
62 int (*xa_rollback_entry) /* xa_rollback function pointer */
63 __P((XID *, int, long));
64 int (*xa_prepare_entry) /* xa_prepare function pointer */
65 __P((XID *, int, long));
66 int (*xa_commit_entry) /* xa_commit function pointer */
67 __P((XID *, int, long));
68 int (*xa_recover_entry) /* xa_recover function pointer */
69 __P((XID *, long, int, long));
70 int (*xa_forget_entry) /* xa_forget function pointer */
71 __P((XID *, int, long));
72 int (*xa_complete_entry) /* xa_complete function pointer */
73 __P((int *, int *, int, long));
75 #endif /* NOTDEFINED */
79 * Flag definitions for the RM switch
81 #define TMNOFLAGS 0x00000000L /* no resource manager features
82 selected */
83 #define TMREGISTER 0x00000001L /* resource manager dynamically
84 registers */
85 #define TMNOMIGRATE 0x00000002L /* resource manager does not support
86 association migration */
87 #define TMUSEASYNC 0x00000004L /* resource manager supports
88 asynchronous operations */
90 * Flag definitions for xa_ and ax_ routines
92 /* use TMNOFLAGGS, defined above, when not specifying other flags */
93 #define TMASYNC 0x80000000L /* perform routine asynchronously */
94 #define TMONEPHASE 0x40000000L /* caller is using one-phase commit
95 optimisation */
96 #define TMFAIL 0x20000000L /* dissociates caller and marks
97 transaction branch rollback-only */
98 #define TMNOWAIT 0x10000000L /* return if blocking condition
99 exists */
100 #define TMRESUME 0x08000000L /* caller is resuming association with
101 suspended transaction branch */
102 #define TMSUCCESS 0x04000000L /* dissociate caller from transaction
103 branch */
104 #define TMSUSPEND 0x02000000L /* caller is suspending, not ending,
105 association */
106 #define TMSTARTRSCAN 0x01000000L /* start a recovery scan */
107 #define TMENDRSCAN 0x00800000L /* end a recovery scan */
108 #define TMMULTIPLE 0x00400000L /* wait for any asynchronous
109 operation */
110 #define TMJOIN 0x00200000L /* caller is joining existing
111 transaction branch */
112 #define TMMIGRATE 0x00100000L /* caller intends to perform
113 migration */
116 * ax_() return codes (transaction manager reports to resource manager)
118 #define TM_JOIN 2 /* caller is joining existing
119 transaction branch */
120 #define TM_RESUME 1 /* caller is resuming association with
121 suspended transaction branch */
122 #define TM_OK 0 /* normal execution */
123 #define TMER_TMERR -1 /* an error occurred in the transaction
124 manager */
125 #define TMER_INVAL -2 /* invalid arguments were given */
126 #define TMER_PROTO -3 /* routine invoked in an improper
127 context */
130 * xa_() return codes (resource manager reports to transaction manager)
132 #define XA_RBBASE 100 /* The inclusive lower bound of the
133 rollback codes */
134 #define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an
135 unspecified reason */
136 #define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a
137 communication failure */
138 #define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */
139 #define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the
140 integrity of the resources was
141 detected */
142 #define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the
143 transaction branch for a reason not
144 on this list */
145 #define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the
146 resource manager */
147 #define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took
148 too long */
149 #define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */
150 #define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the
151 rollback codes */
152 #define XA_NOMIGRATE 9 /* resumption must occur where
153 suspension occurred */
154 #define XA_HEURHAZ 8 /* the transaction branch may have
155 been heuristically completed */
156 #define XA_HEURCOM 7 /* the transaction branch has been
157 heuristically committed */
158 #define XA_HEURRB 6 /* the transaction branch has been
159 heuristically rolled back */
160 #define XA_HEURMIX 5 /* the transaction branch has been
161 heuristically committed and rolled
162 back */
163 #define XA_RETRY 4 /* routine returned with no effect and
164 may be re-issued */
165 #define XA_RDONLY 3 /* the transaction branch was read-only
166 and has been committed */
167 #define XA_OK 0 /* normal execution */
168 #define XAER_ASYNC -2 /* asynchronous operation already
169 outstanding */
170 #define XAER_RMERR -3 /* a resource manager error occurred in
171 the transaction branch */
172 #define XAER_NOTA -4 /* the XID is not valid */
173 #define XAER_INVAL -5 /* invalid arguments were given */
174 #define XAER_PROTO -6 /* routine invoked in an improper
175 context */
176 #define XAER_RMFAIL -7 /* resource manager unavailable */
177 #define XAER_DUPID -8 /* the XID already exists */
178 #define XAER_OUTSIDE -9 /* resource manager doing work outside
179 transaction */
180 #endif /* ifndef XA_H */
182 * End of xa.h header