~drizzle-trunk/drizzle/development

520.4.31 by Monty Taylor
Removed server_id from common_includes.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
520.4.31 by Monty Taylor
Removed server_id from common_includes.
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
520.4.31 by Monty Taylor
Removed server_id from common_includes.
21
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
22
#include <cstring>
23
2221.6.1 by Olaf van der Spek
Refactor
24
namespace drizzled {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
25
520.4.31 by Monty Taylor
Removed server_id from common_includes.
26
extern uint32_t server_id;
27
28
/**
29
  class XID _may_ be binary compatible with the XID structure as
30
  in the X/Open CAE Specification, Distributed Transaction Processing:
31
  The XA Specification, X/Open Company Ltd., 1991.
32
  http://www.opengroup.org/bookstore/catalog/c193.htm
33
34
*/
35
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
36
typedef uint64_t my_xid;
520.4.31 by Monty Taylor
Removed server_id from common_includes.
37
38
#define DRIZZLE_XIDDATASIZE 128
2154.2.23 by Brian Aker
Remove dependency from session of error handler
39
#define DRIZZLE_XID_PREFIX "DrizzleXid"
520.4.31 by Monty Taylor
Removed server_id from common_includes.
40
#define DRIZZLE_XID_PREFIX_LEN 8 // must be a multiple of 8
41
#define DRIZZLE_XID_OFFSET (DRIZZLE_XID_PREFIX_LEN+sizeof(server_id))
42
#define DRIZZLE_XID_GTRID_LEN (DRIZZLE_XID_OFFSET+sizeof(my_xid))
43
2224.1.1 by Olaf van der Spek
Finish removing XID cache
44
class XID
2221.6.1 by Olaf van der Spek
Refactor
45
{
520.4.31 by Monty Taylor
Removed server_id from common_includes.
46
public:
47
  long formatID;
48
  long gtrid_length;
49
  long bqual_length;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
50
  char data[DRIZZLE_XIDDATASIZE];  // not \0-terminated !
520.4.31 by Monty Taylor
Removed server_id from common_includes.
51
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
52
  XID() :
53
    formatID(-1), /* -1 == null */
54
    gtrid_length(0),
55
    bqual_length(0)
56
  {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
57
    memset(data, 0, DRIZZLE_XIDDATASIZE);
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
58
  }
520.4.31 by Monty Taylor
Removed server_id from common_includes.
59
  void set(uint64_t xid);
60
  void set(long g, long b, const char *d);
2318.8.8 by Olaf van der Spek
Refactor Scoreboard
61
  bool is_null() const;
2281.4.7 by Olaf van der Spek
XID
62
  void set_null();
520.4.31 by Monty Taylor
Removed server_id from common_includes.
63
  my_xid quick_get_my_xid();
64
  my_xid get_my_xid();
2221.6.1 by Olaf van der Spek
Refactor
65
  uint32_t length() const;
520.4.31 by Monty Taylor
Removed server_id from common_includes.
66
};
67
68
/**
2154.2.23 by Brian Aker
Remove dependency from session of error handler
69
  struct st_DrizzleXid is binary compatible with the XID structure as
520.4.31 by Monty Taylor
Removed server_id from common_includes.
70
  in the X/Open CAE Specification, Distributed Transaction Processing:
71
  The XA Specification, X/Open Company Ltd., 1991.
72
  http://www.opengroup.org/bookstore/catalog/c193.htm
73
74
*/
1836.2.1 by tdavies
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list
75
2224.1.1 by Olaf van der Spek
Finish removing XID cache
76
class DrizzleXid
2221.6.1 by Olaf van der Spek
Refactor
77
{
1836.2.1 by tdavies
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list
78
public:
520.4.31 by Monty Taylor
Removed server_id from common_includes.
79
  long formatID;
80
  long gtrid_length;
81
  long bqual_length;
82
  char data[DRIZZLE_XIDDATASIZE];  /* Not \0-terminated */
1836.2.1 by tdavies
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list
83
2154.2.23 by Brian Aker
Remove dependency from session of error handler
84
  DrizzleXid() :
1836.2.1 by tdavies
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list
85
    formatID(0),
86
    gtrid_length(0),
87
    bqual_length(0)
88
  {
1836.2.2 by tdavies
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list
89
    memset(data, 0, DRIZZLE_XIDDATASIZE);
1836.2.1 by tdavies
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list
90
  }
520.4.31 by Monty Taylor
Removed server_id from common_includes.
91
};
92
934.2.15 by Jay Pipes
Pulls remainder of XID and xid_cache implementation into xid.cc and xid.h from drizzled/session.cc.
93
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED};
94
extern const char *xa_state_names[];
520.4.31 by Monty Taylor
Removed server_id from common_includes.
95
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
96
/* for recover() plugin::StorageEngine call */
520.4.31 by Monty Taylor
Removed server_id from common_includes.
97
#define MIN_XID_LIST_SIZE  128
98
#define MAX_XID_LIST_SIZE  (1024*128)
99
2224.1.1 by Olaf van der Spek
Finish removing XID cache
100
class XID_STATE
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
101
{
102
public:
103
  XID_STATE() :
104
    xa_state(XA_NOTR),
105
    in_session(false)
106
  {}
934.2.15 by Jay Pipes
Pulls remainder of XID and xid_cache implementation into xid.cc and xid.h from drizzled/session.cc.
107
  /* For now, this is only used to catch duplicated external xids */
108
  XID  xid;                           // transaction identifier
2221.6.1 by Olaf van der Spek
Refactor
109
  xa_states xa_state;            // used by external XA only
934.2.15 by Jay Pipes
Pulls remainder of XID and xid_cache implementation into xid.cc and xid.h from drizzled/session.cc.
110
  bool in_session;
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
111
};
934.2.15 by Jay Pipes
Pulls remainder of XID and xid_cache implementation into xid.cc and xid.h from drizzled/session.cc.
112
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
113
} /* namespace drizzled */
114