1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (c) 2010 Jay Pipes <jaypipes@gmail.com>
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.
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.
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
20
#ifndef DRIZZLED_PLUGIN_MONITORED_IN_TRANSACTION_H
21
#define DRIZZLED_PLUGIN_MONITORED_IN_TRANSACTION_H
31
extern size_t num_trx_monitored_objects;
34
* An abstract interface class for those objects which are tracked
35
* by the TransactionServices component during operations in a
38
* Note that both non-transactional plugin::StorageEngines, non-XA
39
* plugin::TransactionalStorageEngines, and plugin::XaResourceManager
40
* objects are all tracked by the transaction manager in TransactionServices.
42
* Implementing classes should inherit *publically* from
43
* plugin::MonitoredInTransaction, as public inheritance means
44
* "is a" and is the appropriate use here since all implementing classes
45
* *are* monitored in a transaction...
47
class MonitoredInTransaction
51
MonitoredInTransaction();
52
virtual ~MonitoredInTransaction() {}
55
* Returns true if the class should participate
56
* in the SQL transaction.
58
virtual bool participatesInSqlTransaction() const= 0;
61
* Returns true if the class should participate
62
* in the XA transaction.
64
virtual bool participatesInXaTransaction() const= 0;
67
* Returns true if the class should be registered
68
* for every XA transaction regardless of whether
69
* the class modifies the server's state.
73
* As an example, the XaTransactionApplier plugin class returns
74
* true for this virtual method. Even though it does not
75
* change the result of the transaction (it simply is logging
76
* the changes made by other resource managers), the applier
77
* plugin should be enlisted in all XA transactions in order
78
* to be able to rollback or recover its logging activity
81
virtual bool alwaysRegisterForXaTransaction() const= 0;
84
* Returns the "slot" or ID of the monitored resource
92
* The ID or "slot" of the plugin.
96
* Maybe move this into plugin::Plugin? Only issue then is
97
* that all plugins would have a ha_data slot, when only a few
98
* actually need that. Maybe create a plugin::NeedsSessionData?
103
} /* namespace plugin */
104
} /* namespace drizzled */
106
#endif /* DRIZZLED_PLUGIN_MONITORED_IN_TRANSACTION_H */