~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/user_locks/barrier_dictionary.cc

  • Committer: Lee
  • Date: 2008-10-30 22:02:01 UTC
  • mto: (572.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 573.
  • Revision ID: lbieber@lbieber-desktop-20081030220201-elb6qprbzpn7c5a4
add my name to the AUTHORS file

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) 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
 
 
21
 
#include "config.h"
22
 
 
23
 
#include "plugin/user_locks/module.h"
24
 
 
25
 
#include <drizzled/atomics.h>
26
 
#include <drizzled/session.h>
27
 
 
28
 
using namespace drizzled;
29
 
using namespace std;
30
 
 
31
 
namespace user_locks {
32
 
namespace barriers {
33
 
 
34
 
UserBarriers::UserBarriers() :
35
 
  plugin::TableFunction("DATA_DICTIONARY", "USER_DEFINED_BARRIERS")
36
 
{
37
 
  add_field("USER_BARRIER_NAME", plugin::TableFunction::STRING, LARGEST_LOCK_NAME, false);
38
 
  add_field("SESSION_ID", plugin::TableFunction::NUMBER, 0, false);
39
 
  add_field("USER_NAME", plugin::TableFunction::STRING);
40
 
  add_field("WAITER_LIMIT", plugin::TableFunction::NUMBER, 0, false);
41
 
  add_field("GENERATION", plugin::TableFunction::NUMBER, 0, false);
42
 
  add_field("WAITERS", plugin::TableFunction::NUMBER, 0, false);
43
 
  add_field("OBSERVERS", plugin::TableFunction::NUMBER, 0, false);
44
 
}
45
 
 
46
 
UserBarriers::Generator::Generator(drizzled::Field **arg) :
47
 
  drizzled::plugin::TableFunction::Generator(arg)
48
 
{
49
 
  Barriers::getInstance().Copy(barrier_map);
50
 
  iter= barrier_map.begin();
51
 
}
52
 
 
53
 
bool UserBarriers::Generator::populate()
54
 
{
55
 
 
56
 
  while (iter != barrier_map.end())
57
 
  {
58
 
    // USER_BARRIER_NAME
59
 
    push((*iter).first.getLockName());
60
 
 
61
 
    // SESSION_ID
62
 
    push((*iter).second->getOwner());
63
 
     
64
 
    // USER_NAME
65
 
    push((*iter).first.getUser());
66
 
    
67
 
    // WAITER_LIMIT
68
 
    push((*iter).second->getLimit());
69
 
    
70
 
    // GENERATION
71
 
    push((*iter).second->getGeneration());
72
 
    
73
 
    // WAITERS
74
 
    push((*iter).second->sizeWaiters());
75
 
    
76
 
    // OBSERVERS
77
 
    push((*iter).second->sizeObservers());
78
 
 
79
 
    iter++;
80
 
    return true;
81
 
  }
82
 
 
83
 
  return false;
84
 
}
85
 
 
86
 
} /* namespace barriers */
87
 
} /* namespace user_locks */