1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
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
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
5 |
* Copyright (C) 2010 Sun Microsystems, Inc.
|
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
6 |
*
|
7 |
* This program is free software; you can redistribute it and/or modify
|
|
8 |
* it under the terms of the GNU General Public License as published by
|
|
9 |
* the Free Software Foundation; either version 2 of the License, or
|
|
10 |
* (at your option) any later version.
|
|
11 |
*
|
|
12 |
* This program is distributed in the hope that it will be useful,
|
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
* GNU General Public License for more details.
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License
|
|
18 |
* along with this program; if not, write to the Free Software
|
|
19 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20 |
*/
|
|
21 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
22 |
#pragma once
|
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
23 |
|
2275.3.2
by Olaf van der Spek
Session Cache |
24 |
#include <boost/thread/mutex.hpp> |
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
25 |
#include <boost/unordered_map.hpp> |
2069.4.4
by Brian Aker
Create a shared form of the instance which is a bit more heavier weight then |
26 |
#include <drizzled/identifier.h> |
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
27 |
|
28 |
namespace drizzled { |
|
29 |
namespace table { |
|
30 |
||
2275.3.1
by Olaf van der Spek
Remove table::Cache::singleton() |
31 |
typedef boost::unordered_multimap<identifier::Table::Key, Concurrent*> CacheMap; |
32 |
typedef std::pair<CacheMap::const_iterator, CacheMap::const_iterator> CacheRange; |
|
1877.2.6
by Brian Aker
Fixed header/etc. |
33 |
|
34 |
class Cache |
|
35 |
{
|
|
36 |
public: |
|
2272.1.3
by Olaf van der Spek
Table Cache |
37 |
static CacheMap& getCache() |
1877.2.6
by Brian Aker
Fixed header/etc. |
38 |
{
|
39 |
return cache; |
|
40 |
}
|
|
1877.2.7
by Brian Aker
Encapsulate more of the table cache. |
41 |
|
2272.1.3
by Olaf van der Spek
Table Cache |
42 |
static void rehash(size_t arg) |
1910.2.13
by Brian Aker
Rehash the size on the actual table cache as well. |
43 |
{
|
44 |
cache.rehash(arg); |
|
45 |
}
|
|
46 |
||
2272.1.3
by Olaf van der Spek
Table Cache |
47 |
static boost::mutex& mutex() |
1938.4.10
by Brian Aker
Convert LOCK_open to lock in mutex |
48 |
{
|
49 |
return _mutex; |
|
50 |
}
|
|
51 |
||
2272.1.3
by Olaf van der Spek
Table Cache |
52 |
static bool areTablesUsed(Table*, bool wait_for_name_lock); |
53 |
static void removeSchema(const identifier::Schema&); |
|
54 |
static bool removeTable(Session&, const identifier::Table&, uint32_t flags); |
|
55 |
static void release(table::instance::Shared*); |
|
56 |
static void insert(table::Concurrent*); |
|
1938.4.10
by Brian Aker
Convert LOCK_open to lock in mutex |
57 |
private: |
2272.1.3
by Olaf van der Spek
Table Cache |
58 |
static CacheMap cache; |
59 |
static boost::mutex _mutex; |
|
1877.2.6
by Brian Aker
Fixed header/etc. |
60 |
};
|
61 |
||
2272.1.2
by Olaf van der Spek
Table Cache |
62 |
CacheMap& getCache(); |
63 |
void remove_table(table::Concurrent*); |
|
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
64 |
|
65 |
} /* namepsace table */ |
|
66 |
} /* namepsace drizzled */ |
|
67 |