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 |
*
|
|
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_HA_TRX_INFO_H
|
|
21 |
#define DRIZZLED_HA_TRX_INFO_H
|
|
22 |
||
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
23 |
|
24 |
class Session_TRANS; |
|
25 |
class handlerton; |
|
26 |
||
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
27 |
/**
|
28 |
Either statement transaction or normal transaction - related
|
|
29 |
thread-specific storage engine data.
|
|
30 |
||
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().
|
|
35 |
||
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
|
|
39 |
necessary.
|
|
40 |
||
41 |
@sa General description of transaction handling in handler.cc.
|
|
42 |
*/
|
|
43 |
||
44 |
class Ha_trx_info |
|
45 |
{
|
|
46 |
public: |
|
47 |
/** Register this storage engine in the given transaction context. */
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
48 |
void register_ha(Session_TRANS *trans, handlerton *ht_arg); |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
49 |
|
50 |
/** Clear, prepare for reuse. */
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
51 |
void reset(); |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
52 |
Ha_trx_info() { reset(); } |
53 |
||
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
54 |
void set_trx_read_write(); |
55 |
bool is_trx_read_write() const; |
|
56 |
bool is_started() const; |
|
57 |
||
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
58 |
/** Mark this transaction read-write if the argument is read-write. */
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
59 |
void coalesce_trx_with(const Ha_trx_info *stmt_trx); |
60 |
Ha_trx_info *next() const; |
|
61 |
handlerton *ht() const; |
|
62 |
||
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
63 |
private: |
64 |
enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 }; |
|
65 |
/** Auxiliary, used for ha_list management */
|
|
66 |
Ha_trx_info *m_next; |
|
67 |
/**
|
|
68 |
Although a given Ha_trx_info instance is currently always used
|
|
69 |
for the same storage engine, 'ht' is not-NULL only when the
|
|
70 |
corresponding storage is a part of a transaction.
|
|
71 |
*/
|
|
72 |
handlerton *m_ht; |
|
73 |
/**
|
|
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.
|
|
77 |
*/
|
|
78 |
unsigned char m_flags; |
|
79 |
};
|
|
80 |
||
81 |
#endif /* DRIZZLED_HA_TRX_INFO_H */ |