1933.1.3
by Brian Aker
First pass though barriers. |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2010 Brian Aker
|
|
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; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
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 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
21 |
#include <config.h> |
1933.1.3
by Brian Aker
First pass though barriers. |
22 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
23 |
#include <plugin/user_locks/module.h> |
1933.1.3
by Brian Aker
First pass though barriers. |
24 |
|
25 |
#include <drizzled/atomics.h> |
|
26 |
#include <drizzled/session.h> |
|
27 |
||
28 |
using namespace drizzled; |
|
29 |
using namespace std; |
|
30 |
||
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
31 |
namespace user_locks { |
32 |
namespace barriers { |
|
33 |
||
34 |
UserBarriers::UserBarriers() : |
|
1996.1.1
by Brian Aker
Update name usage for user defined objects. |
35 |
plugin::TableFunction("DATA_DICTIONARY", "USER_DEFINED_BARRIERS") |
1933.1.3
by Brian Aker
First pass though barriers. |
36 |
{
|
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
37 |
add_field("USER_BARRIER_NAME", plugin::TableFunction::STRING, LARGEST_LOCK_NAME, false); |
1933.1.3
by Brian Aker
First pass though barriers. |
38 |
add_field("SESSION_ID", plugin::TableFunction::NUMBER, 0, false); |
39 |
add_field("USER_NAME", plugin::TableFunction::STRING); |
|
1933.1.7
by Brian Aker
Merge in wait_until command. |
40 |
add_field("WAITER_LIMIT", plugin::TableFunction::NUMBER, 0, false); |
1933.1.5
by Brian Aker
Implemented barrier wait_count feature. |
41 |
add_field("GENERATION", plugin::TableFunction::NUMBER, 0, false); |
1933.1.7
by Brian Aker
Merge in wait_until command. |
42 |
add_field("WAITERS", plugin::TableFunction::NUMBER, 0, false); |
43 |
add_field("OBSERVERS", plugin::TableFunction::NUMBER, 0, false); |
|
1933.1.3
by Brian Aker
First pass though barriers. |
44 |
}
|
45 |
||
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
46 |
UserBarriers::Generator::Generator(drizzled::Field **arg) : |
1933.1.3
by Brian Aker
First pass though barriers. |
47 |
drizzled::plugin::TableFunction::Generator(arg) |
48 |
{
|
|
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
49 |
Barriers::getInstance().Copy(barrier_map); |
1933.1.3
by Brian Aker
First pass though barriers. |
50 |
iter= barrier_map.begin(); |
51 |
}
|
|
52 |
||
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
53 |
bool UserBarriers::Generator::populate() |
1933.1.3
by Brian Aker
First pass though barriers. |
54 |
{
|
55 |
||
56 |
while (iter != barrier_map.end()) |
|
57 |
{
|
|
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
58 |
// USER_BARRIER_NAME
|
2192.4.7
by Olaf van der Spek
Use "iter->" instead of "(*iter)." |
59 |
push(iter->first.getLockName()); |
1933.1.3
by Brian Aker
First pass though barriers. |
60 |
|
61 |
// SESSION_ID
|
|
2192.4.7
by Olaf van der Spek
Use "iter->" instead of "(*iter)." |
62 |
push(iter->second->getOwner()); |
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
63 |
|
1933.1.3
by Brian Aker
First pass though barriers. |
64 |
// USER_NAME
|
2192.4.7
by Olaf van der Spek
Use "iter->" instead of "(*iter)." |
65 |
push(iter->first.getUser()); |
1933.1.5
by Brian Aker
Implemented barrier wait_count feature. |
66 |
|
1933.1.7
by Brian Aker
Merge in wait_until command. |
67 |
// WAITER_LIMIT
|
2192.4.7
by Olaf van der Spek
Use "iter->" instead of "(*iter)." |
68 |
push(iter->second->getLimit()); |
1933.1.5
by Brian Aker
Implemented barrier wait_count feature. |
69 |
|
70 |
// GENERATION
|
|
2192.4.7
by Olaf van der Spek
Use "iter->" instead of "(*iter)." |
71 |
push(iter->second->getGeneration()); |
1933.1.7
by Brian Aker
Merge in wait_until command. |
72 |
|
73 |
// WAITERS
|
|
2192.4.7
by Olaf van der Spek
Use "iter->" instead of "(*iter)." |
74 |
push(iter->second->sizeWaiters()); |
1933.1.7
by Brian Aker
Merge in wait_until command. |
75 |
|
76 |
// OBSERVERS
|
|
2192.4.7
by Olaf van der Spek
Use "iter->" instead of "(*iter)." |
77 |
push(iter->second->sizeObservers()); |
1933.1.3
by Brian Aker
First pass though barriers. |
78 |
|
79 |
iter++; |
|
80 |
return true; |
|
81 |
}
|
|
82 |
||
83 |
return false; |
|
84 |
}
|
|
1933.1.4
by Brian Aker
Fix errror messages and namespace. |
85 |
|
86 |
} /* namespace barriers */ |
|
87 |
} /* namespace user_locks */ |