1861.5.2
by Brian Aker
Merge in generator for processlist. |
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 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
21 |
#pragma once
|
1861.5.2
by Brian Aker
Merge in generator for processlist. |
22 |
|
1932.3.4
by Brian Aker
Move counter lock so that ownership is held by session_list. |
23 |
#include <boost/thread/mutex.hpp> |
2154.2.20
by Brian Aker
Merge in bits for header cleanup. |
24 |
|
25 |
#include <drizzled/identifier/user.h> |
|
26 |
#include <drizzled/session/cache.h> |
|
1861.5.2
by Brian Aker
Merge in generator for processlist. |
27 |
|
28 |
namespace drizzled { |
|
29 |
namespace generator { |
|
30 |
||
31 |
class Session |
|
32 |
{
|
|
1966.2.5
by Brian Aker
Style change around session list. |
33 |
session::Cache::list local_list; |
34 |
session::Cache::list::const_iterator iter; |
|
2246.4.11
by Olaf van der Spek
Remove const_reference and reference from identifier::User |
35 |
const identifier::User& user; |
1861.5.2
by Brian Aker
Merge in generator for processlist. |
36 |
|
37 |
public: |
|
38 |
||
2246.4.11
by Olaf van der Spek
Remove const_reference and reference from identifier::User |
39 |
Session(const identifier::User& arg) : |
2015.3.1
by Brian Aker
Encapsulate client call. Also remove the need to call current_session when |
40 |
user(arg) |
1861.5.2
by Brian Aker
Merge in generator for processlist. |
41 |
{
|
2275.3.2
by Olaf van der Spek
Session Cache |
42 |
boost::mutex::scoped_lock scopedLock(session::Cache::mutex()); |
2282.1.2
by Olaf van der Spek
Session Cache |
43 |
local_list= session::Cache::getCache(); |
1861.5.2
by Brian Aker
Merge in generator for processlist. |
44 |
iter= local_list.begin(); |
45 |
}
|
|
46 |
||
2246.4.12
by Olaf van der Spek
Remove const_reference and reference from Session |
47 |
operator drizzled::Session*() |
1861.5.2
by Brian Aker
Merge in generator for processlist. |
48 |
{
|
49 |
while (iter != local_list.end()) |
|
50 |
{
|
|
2246.4.12
by Olaf van der Spek
Remove const_reference and reference from Session |
51 |
drizzled::Session* ret= iter->get(); |
2015.3.2
by Brian Aker
We just need to use a pointer, we already hold the lock for the shared |
52 |
iter++; |
53 |
||
2227.4.11
by Olaf van der Spek
Refactor Session |
54 |
if (ret->isViewable(user)) |
55 |
return ret; |
|
1861.5.2
by Brian Aker
Merge in generator for processlist. |
56 |
}
|
2246.4.12
by Olaf van der Spek
Remove const_reference and reference from Session |
57 |
return NULL; |
1861.5.2
by Brian Aker
Merge in generator for processlist. |
58 |
}
|
59 |
};
|
|
60 |
||
61 |
} /* namespace generator */ |
|
62 |
} /* namespace drizzled */ |
|
63 |