Drizzled Public API Documentation

xa_resource_manager.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, Inc.
5  * Copyright (C) 2010 Jay Pipes <jaypipes@gmail.com>
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 
21 #pragma once
22 
23 #include <boost/unordered_set.hpp>
24 #include <drizzled/visibility.h>
25 
26 namespace drizzled {
27 namespace plugin {
28 
34 {
35 public:
36  virtual ~XaResourceManager() {}
37 
38  int xaPrepare(Session *session, bool normal_transaction)
39  {
40  return doXaPrepare(session, normal_transaction);
41  }
42 
43  int xaCommit(Session *session, bool normal_transaction)
44  {
45  return doXaCommit(session, normal_transaction);
46  }
47 
48  int xaRollback(Session *session, bool normal_transaction)
49  {
50  return doXaRollback(session, normal_transaction);
51  }
52 
53  int xaCommitXid(XID *xid)
54  {
55  return doXaCommitXid(xid);
56  }
57 
58  int xaRollbackXid(XID *xid)
59  {
60  return doXaRollbackXid(xid);
61  }
62 
63  int xaRecover(XID * append_to, size_t len)
64  {
65  return doXaRecover(append_to, len);
66  }
67 
68  uint64_t getCurrentTransactionId(Session *session)
69  {
70  return doGetCurrentTransactionId(session);
71  }
72 
73  uint64_t getNewTransactionId(Session *session)
74  {
75  return doGetNewTransactionId(session);
76  }
77 
78  typedef ::boost::unordered_set<my_xid> commit_list_set;
83  static int commitOrRollbackXID(XID *xid, bool commit);
84  static int recoverAllXids();
85  static int recoverAllXids(const commit_list_set& commit_list);
86 
87  /* Class Methods for operating on plugin */
88  static bool addPlugin(plugin::XaResourceManager *manager);
89  static void removePlugin(plugin::XaResourceManager *manager);
90 private:
94  virtual int doXaCommit(Session *session, bool normal_transaction)= 0;
98  virtual int doXaRollback(Session *session, bool normal_transaction)= 0;
102  virtual int doXaPrepare(Session *session, bool normal_transaction)= 0;
106  virtual int doXaRollbackXid(XID *xid)= 0;
110  virtual int doXaCommitXid(XID *xid)= 0;
123  virtual int doXaRecover(XID * append_to, size_t len)= 0;
124 
125  virtual uint64_t doGetCurrentTransactionId(Session *session)= 0;
126 
127  virtual uint64_t doGetNewTransactionId(Session *session)= 0;
128 };
129 
130 } /* namespace plugin */
131 } /* namespace drizzled */
132 
TODO: Rename this file - func.h is stupid.
#define DRIZZLED_API
Definition: visibility.h:62
Visibility Control Macros.
Definition: engine.cc:41