~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/transaction_services.h

  • Committer: Monty Taylor
  • Date: 2010-02-05 08:11:15 UTC
  • mfrom: (1283 build)
  • mto: (1273.13.43 fix_is)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: mordred@inaugust.com-20100205081115-dr82nvrwv4lvw7sd
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
/**
 
21
 * @file Transaction processing code
 
22
 */
 
23
 
 
24
#ifndef DRIZZLED_TRANSACTION_SERVICES_H
 
25
#define DRIZZLED_TRANSACTION_SERVICES_H
 
26
 
 
27
namespace drizzled
 
28
{
 
29
 
 
30
/* some forward declarations needed */
 
31
namespace plugin
 
32
{
 
33
  class StorageEngine;
 
34
}
 
35
 
 
36
class Session;
 
37
class NamedSavepoint;
 
38
 
 
39
/**
 
40
 * This is a class which manages the XA transaction processing
 
41
 * in the server
 
42
 */
 
43
class TransactionServices
 
44
{
 
45
public:
 
46
  /**
 
47
   * Constructor
 
48
   */
 
49
  TransactionServices() {}
 
50
 
 
51
  /**
 
52
   * Singleton method
 
53
   * Returns the singleton instance of TransactionServices
 
54
   */
 
55
  static inline TransactionServices &singleton()
 
56
  {
 
57
    static TransactionServices transaction_services;
 
58
    return transaction_services;
 
59
  }
 
60
  /* transactions: interface to plugin::StorageEngine functions */
 
61
  int ha_commit_one_phase(Session *session, bool all);
 
62
  int ha_rollback_trans(Session *session, bool all);
 
63
 
 
64
  /* transactions: these functions never call plugin::StorageEngine functions directly */
 
65
  int ha_commit_trans(Session *session, bool all);
 
66
  int ha_autocommit_or_rollback(Session *session, int error);
 
67
 
 
68
  /* savepoints */
 
69
  int ha_rollback_to_savepoint(Session *session, NamedSavepoint &sv);
 
70
  int ha_savepoint(Session *session, NamedSavepoint &sv);
 
71
  int ha_release_savepoint(Session *session, NamedSavepoint &sv);
 
72
  bool mysql_xa_recover(Session *session);
 
73
 
 
74
  /* these are called by storage engines */
 
75
  void trans_register_ha(Session *session, bool all, plugin::StorageEngine *engine);
 
76
};
 
77
 
 
78
} /* namespace drizzled */
 
79
 
 
80
#endif /* DRIZZLED_TRANSACTION_SERVICES_H */