18
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_RESOURCE_CONTEXT_H
22
#define DRIZZLED_RESOURCE_CONTEXT_H
31
class MonitoredInTransaction;
32
class TransactionalStorageEngine;
33
class XaResourceManager;
20
#ifndef DRIZZLED_HA_TRX_INFO_H
21
#define DRIZZLED_HA_TRX_INFO_H
37
* Either statement transaction or normal transaction - related
38
* session-specific resource manager data state.
40
* If a resource manager participates in a statement/transaction,
41
* an instance of this class is present in
42
* session->transaction.{stmt|all}.resource_contexts.
44
* When it's time to commit or rollback, each resource context
45
* is used to access the resource manager's prepare()/commit()/rollback()
46
* methods, and also to evaluate if a full two phase commit is
49
* @sa General description of transaction handling in drizzled/transaction_services.cc.
28
Either statement transaction or normal transaction - related
29
thread-specific storage engine data.
31
If a storage engine participates in a statement/transaction,
32
an instance of this class is present in
33
session->transaction.{stmt|all}.ha_list. The addition to
34
{stmt|all}.ha_list is made by trans_register_ha().
36
When it's time to commit or rollback, each element of ha_list
37
is used to access storage engine's prepare()/commit()/rollback()
38
methods, and also to evaluate if a full two phase commit is
41
@sa General description of transaction handling in handler.cc.
56
xa_resource_manager(NULL),
57
trx_storage_engine(NULL),
47
/** Register this storage engine in the given transaction context. */
48
void register_ha(Session_TRANS *trans, StorageEngine *engine_arg);
61
50
/** Clear, prepare for reuse. */
65
* Marks that the underlying resource manager
66
* has modified data state.
68
void markModifiedData();
71
* Returns true if the underlying resource manager
72
* has modified data state.
74
bool hasModifiedData() const;
77
* Returns true if the underlying resource
78
* manager has registered with the transaction
79
* manager for this transaction.
81
bool isStarted() const;
84
* Mark this context as modifying data if the argument has also modified data
86
void coalesceWith(const ResourceContext *stmt_trx);
89
* Returns the underlying descriptor for the resource
90
* this context tracks.
92
plugin::MonitoredInTransaction *getMonitored() const
98
* Sets the underlying descriptor for the resource
100
void setMonitored(plugin::MonitoredInTransaction *in_monitored)
102
monitored= in_monitored;
106
* Returns the underlying transactional storage engine
107
* this context tracks or NULL if not SQL transactional capable.
109
plugin::TransactionalStorageEngine *getTransactionalStorageEngine() const
111
return trx_storage_engine;
115
* Sets the underlying transactional storage engine
117
void setTransactionalStorageEngine(plugin::TransactionalStorageEngine *in_trx_storage_engine)
119
trx_storage_engine= in_trx_storage_engine;
123
* Returns the underlying XA resource manager
124
* this context tracks or NULL if not XA capable.
126
plugin::XaResourceManager *getXaResourceManager() const
128
return xa_resource_manager;
132
* Sets the underlying xa resource manager
134
void setXaResourceManager(plugin::XaResourceManager *in_xa_resource_manager)
136
xa_resource_manager= in_xa_resource_manager;
52
Ha_trx_info() { reset(); }
54
void set_trx_read_write();
55
bool is_trx_read_write() const;
56
bool is_started() const;
58
/** Mark this transaction read-write if the argument is read-write. */
59
void coalesce_trx_with(const Ha_trx_info *stmt_trx);
60
Ha_trx_info *next() const;
61
StorageEngine *engine() const;
140
* A descriptor of the monitored resource
142
plugin::MonitoredInTransaction *monitored;
144
* The XA resource manager or NULL if not XA capable.
146
plugin::XaResourceManager *xa_resource_manager;
148
* The transactional storage engine or NULL if not SQL transaction capable.
150
plugin::TransactionalStorageEngine *trx_storage_engine;
152
* Whether the underlying resource manager has changed
64
enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 };
65
/** Auxiliary, used for ha_list management */
68
Although a given Ha_trx_info instance is currently always used
69
for the same storage engine, 'engine' is not-NULL only when the
70
corresponding storage is a part of a transaction.
72
StorageEngine *m_engine;
74
Transaction flags related to this engine.
75
Not-null only if this instance is a part of transaction.
76
May assume a combination of enum values above.
78
unsigned char m_flags;
158
} /* namespace drizzled */
160
#endif /* DRIZZLED_RESOURCE_CONTEXT_H */
81
#endif /* DRIZZLED_HA_TRX_INFO_H */