~drizzle-trunk/drizzle/development

670.2.4 by Monty Taylor
Removed more stuff from the headers.
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.
670.2.4 by Monty Taylor
Removed more stuff from the headers.
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
670.2.4 by Monty Taylor
Removed more stuff from the headers.
21
1859.2.3 by Brian Aker
Move lock over to lock.h (out of sessio.h).
22
#include <vector>
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
23
#include <drizzled/thr_lock.h>
24
#include <drizzled/locking/global.h>
670.2.4 by Monty Taylor
Removed more stuff from the headers.
25
2252.1.15 by Olaf van der Spek
Common fwd
26
namespace drizzled {
1859.2.3 by Brian Aker
Move lock over to lock.h (out of sessio.h).
27
28
class DrizzleLock
29
{
30
public:
31
  Table **getTable()
32
  {
33
    return &table[0];
34
  }
35
36
  THR_LOCK_DATA **getLocks()
37
  {
38
    return &locks[0];
39
  }
40
1948.2.2 by Brian Aker
Merge in change where we remove the need for the additional variable for
41
  size_t sizeTable() const
42
  {
43
    return table.size();
44
  }
45
46
  void resizeTable(size_t arg)
47
  {
48
    table.resize(arg);
1859.2.3 by Brian Aker
Move lock over to lock.h (out of sessio.h).
49
  }
50
1948.2.3 by Brian Aker
Update on lock count.
51
  size_t sizeLock() const
52
  {
53
    return lock_count;
54
  }
55
1859.2.3 by Brian Aker
Move lock over to lock.h (out of sessio.h).
56
  void resetLock()
57
  {
58
    lock_count= 0;
59
  }
60
61
  void setLock(size_t arg)
62
  {
63
    lock_count= arg;
64
  }
65
1859.2.4 by Brian Aker
A few cleanups.
66
  void reset(void);
67
  void unlock(uint32_t count);
68
1948.2.2 by Brian Aker
Merge in change where we remove the need for the additional variable for
69
  DrizzleLock(size_t table_count_arg)
1859.2.3 by Brian Aker
Move lock over to lock.h (out of sessio.h).
70
  {
1948.2.2 by Brian Aker
Merge in change where we remove the need for the additional variable for
71
    table.resize(table_count_arg);
72
    lock_count= table_count_arg * 2;
1859.2.3 by Brian Aker
Move lock over to lock.h (out of sessio.h).
73
    locks.resize(lock_count);
74
  }
75
1948.2.2 by Brian Aker
Merge in change where we remove the need for the additional variable for
76
private:
1948.2.3 by Brian Aker
Update on lock count.
77
  uint32_t lock_count;
78
1948.2.2 by Brian Aker
Merge in change where we remove the need for the additional variable for
79
  std::vector<Table *> table;
80
  std::vector<THR_LOCK_DATA *> locks;
81
  std::vector<THR_LOCK_DATA *> copy_of;
1859.2.3 by Brian Aker
Move lock over to lock.h (out of sessio.h).
82
};
670.2.4 by Monty Taylor
Removed more stuff from the headers.
83
1910.2.7 by Brian Aker
Rename lock methods to be style + well make sense.
84
/* lockTables() and open_table() flags bits */
670.2.4 by Monty Taylor
Removed more stuff from the headers.
85
#define DRIZZLE_LOCK_IGNORE_GLOBAL_READ_LOCK      0x0001
86
#define DRIZZLE_LOCK_IGNORE_FLUSH                 0x0002
87
#define DRIZZLE_LOCK_NOTIFY_IF_NEED_REOPEN        0x0004
88
#define DRIZZLE_OPEN_TEMPORARY_ONLY               0x0008
89
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
90
} /* namespace drizzled */
91