575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
5 |
* Copyright (C) 2010 Jay Pipes <jaypipes@gmail.com>
|
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
6 |
*
|
7 |
* This program is free software; you can redistribute it and/or modify
|
|
8 |
* it under the terms of the GNU General Public License as published by
|
|
9 |
* the Free Software Foundation; version 2 of the License.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
21 |
#ifndef DRIZZLED_RESOURCE_CONTEXT_H
|
22 |
#define DRIZZLED_RESOURCE_CONTEXT_H
|
|
23 |
||
24 |
#include <cstddef> |
|
25 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
26 |
namespace drizzled |
27 |
{
|
|
28 |
||
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
29 |
namespace plugin |
30 |
{
|
|
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
31 |
class MonitoredInTransaction; |
32 |
class TransactionalStorageEngine; |
|
33 |
class XaResourceManager; |
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
34 |
}
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
35 |
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
36 |
/**
|
1273.1.12
by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite |
37 |
* Either statement transaction or normal transaction - related
|
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
38 |
* session-specific resource manager data state.
|
1273.1.12
by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite |
39 |
*
|
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
40 |
* If a resource manager participates in a statement/transaction,
|
1273.1.12
by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite |
41 |
* an instance of this class is present in
|
42 |
* session->transaction.{stmt|all}.resource_contexts.
|
|
43 |
*
|
|
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
44 |
* When it's time to commit or rollback, each resource context
|
45 |
* is used to access the resource manager's prepare()/commit()/rollback()
|
|
1273.1.12
by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite |
46 |
* methods, and also to evaluate if a full two phase commit is
|
47 |
* necessary.
|
|
48 |
*
|
|
49 |
* @sa General description of transaction handling in drizzled/transaction_services.cc.
|
|
50 |
*/
|
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
51 |
class ResourceContext |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
52 |
{
|
53 |
public: |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
54 |
ResourceContext() : |
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
55 |
monitored(NULL), |
56 |
xa_resource_manager(NULL), |
|
57 |
trx_storage_engine(NULL), |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
58 |
modified_data(false) |
59 |
{}
|
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
60 |
|
61 |
/** Clear, prepare for reuse. */
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
62 |
void reset(); |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
63 |
|
1273.1.12
by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite |
64 |
/**
|
65 |
* Marks that the underlying resource manager
|
|
66 |
* has modified data state.
|
|
67 |
*/
|
|
68 |
void markModifiedData(); |
|
69 |
||
70 |
/**
|
|
71 |
* Returns true if the underlying resource manager
|
|
72 |
* has modified data state.
|
|
73 |
*/
|
|
74 |
bool hasModifiedData() const; |
|
75 |
||
76 |
/**
|
|
77 |
* Returns true if the underlying resource
|
|
78 |
* manager has registered with the transaction
|
|
79 |
* manager for this transaction.
|
|
80 |
*/
|
|
81 |
bool isStarted() const; |
|
82 |
||
83 |
/**
|
|
84 |
* Mark this context as modifying data if the argument has also modified data
|
|
85 |
*/
|
|
86 |
void coalesceWith(const ResourceContext *stmt_trx); |
|
87 |
||
88 |
/**
|
|
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
89 |
* Returns the underlying descriptor for the resource
|
1273.1.12
by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite |
90 |
* this context tracks.
|
91 |
*/
|
|
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
92 |
plugin::MonitoredInTransaction *getMonitored() const |
93 |
{
|
|
94 |
return monitored; |
|
95 |
}
|
|
96 |
||
97 |
/**
|
|
98 |
* Sets the underlying descriptor for the resource
|
|
99 |
*/
|
|
100 |
void setMonitored(plugin::MonitoredInTransaction *in_monitored) |
|
101 |
{
|
|
102 |
monitored= in_monitored; |
|
103 |
}
|
|
104 |
||
105 |
/**
|
|
106 |
* Returns the underlying transactional storage engine
|
|
107 |
* this context tracks or NULL if not SQL transactional capable.
|
|
108 |
*/
|
|
109 |
plugin::TransactionalStorageEngine *getTransactionalStorageEngine() const |
|
110 |
{
|
|
111 |
return trx_storage_engine; |
|
112 |
}
|
|
113 |
||
114 |
/**
|
|
115 |
* Sets the underlying transactional storage engine
|
|
116 |
*/
|
|
117 |
void setTransactionalStorageEngine(plugin::TransactionalStorageEngine *in_trx_storage_engine) |
|
118 |
{
|
|
119 |
trx_storage_engine= in_trx_storage_engine; |
|
120 |
}
|
|
121 |
||
122 |
/**
|
|
123 |
* Returns the underlying XA resource manager
|
|
124 |
* this context tracks or NULL if not XA capable.
|
|
125 |
*/
|
|
126 |
plugin::XaResourceManager *getXaResourceManager() const |
|
127 |
{
|
|
128 |
return xa_resource_manager; |
|
129 |
}
|
|
130 |
||
131 |
/**
|
|
132 |
* Sets the underlying xa resource manager
|
|
133 |
*/
|
|
134 |
void setXaResourceManager(plugin::XaResourceManager *in_xa_resource_manager) |
|
135 |
{
|
|
136 |
xa_resource_manager= in_xa_resource_manager; |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
137 |
}
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
138 |
private: |
139 |
/**
|
|
1273.1.30
by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager |
140 |
* A descriptor of the monitored resource
|
141 |
*/
|
|
142 |
plugin::MonitoredInTransaction *monitored; |
|
143 |
/**
|
|
144 |
* The XA resource manager or NULL if not XA capable.
|
|
145 |
*/
|
|
146 |
plugin::XaResourceManager *xa_resource_manager; |
|
147 |
/**
|
|
148 |
* The transactional storage engine or NULL if not SQL transaction capable.
|
|
149 |
*/
|
|
150 |
plugin::TransactionalStorageEngine *trx_storage_engine; |
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
151 |
/**
|
1273.1.12
by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite |
152 |
* Whether the underlying resource manager has changed
|
153 |
* some data state.
|
|
154 |
*/
|
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
155 |
bool modified_data; |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
156 |
};
|
157 |
||
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
158 |
} /* namespace drizzled */ |
159 |
||
160 |
#endif /* DRIZZLED_RESOURCE_CONTEXT_H */ |