1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
20 |
#ifndef DRIZZLED_TRANSACTION_CONTEXT_H
|
|
21 |
#define DRIZZLED_TRANSACTION_CONTEXT_H
|
|
22 |
||
23 |
#include <vector> |
|
24 |
||
25 |
namespace drizzled |
|
26 |
{
|
|
27 |
class ResourceContext; |
|
28 |
||
29 |
class TransactionContext |
|
30 |
{
|
|
31 |
public: |
|
32 |
TransactionContext() : |
|
33 |
no_2pc(false), |
|
34 |
resource_contexts(), |
|
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
35 |
modified_non_trans_data(false) |
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
36 |
{}
|
37 |
||
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
38 |
void reset() { no_2pc= false; modified_non_trans_data= false; resource_contexts.clear();} |
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
39 |
|
40 |
typedef std::vector<ResourceContext *> ResourceContexts; |
|
41 |
||
42 |
void setResourceContexts(ResourceContexts &new_contexts) |
|
43 |
{
|
|
44 |
resource_contexts.assign(new_contexts.begin(), new_contexts.end()); |
|
45 |
}
|
|
46 |
||
47 |
ResourceContexts &getResourceContexts() |
|
48 |
{
|
|
49 |
return resource_contexts; |
|
50 |
}
|
|
51 |
/** Register a resource context in this transaction context */
|
|
52 |
void registerResource(ResourceContext *resource) |
|
53 |
{
|
|
54 |
resource_contexts.push_back(resource); |
|
55 |
}
|
|
56 |
||
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
57 |
/**
|
58 |
* Marks that this transaction has modified state
|
|
59 |
* of some non-transactional data.
|
|
60 |
*/
|
|
61 |
void markModifiedNonTransData() |
|
62 |
{
|
|
63 |
modified_non_trans_data= true; |
|
64 |
}
|
|
65 |
||
66 |
/**
|
|
67 |
* Returns true if the transaction has modified
|
|
68 |
* state of some non-transactional data.
|
|
69 |
*/
|
|
70 |
bool hasModifiedNonTransData() const |
|
71 |
{
|
|
72 |
return modified_non_trans_data; |
|
73 |
}
|
|
74 |
||
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
75 |
/* true is not all entries in the resource contexts support 2pc */
|
76 |
bool no_2pc; |
|
77 |
private: |
|
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
78 |
/** Resource that registered in this transaction */
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
79 |
ResourceContexts resource_contexts; |
1273.1.13
by Jay Pipes
Style cleanup around TransactionContext::modified_non_trans_table and dead code removal |
80 |
/** Whether this transaction has changed non-transaction data state */
|
81 |
bool modified_non_trans_data; |
|
1273.1.10
by Jay Pipes
* Renames Ha_trx_info to drizzled::ResourceContext |
82 |
};
|
83 |
||
84 |
} /* namespace drizzled */ |
|
85 |
||
86 |
#endif /* DRIZZLED_TRANSACTION_CONTEXT_H */ |