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 |
||
22 |
#ifndef DRIZZLED_TABLE_CACHE_H
|
|
23 |
#define DRIZZLED_TABLE_CACHE_H
|
|
24 |
||
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> |
27 |
#include <drizzled/table/instance.h> |
|
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
28 |
|
29 |
namespace drizzled { |
|
2069.4.4
by Brian Aker
Create a shared form of the instance which is a bit more heavier weight then |
30 |
|
31 |
class Session; |
|
32 |
||
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
33 |
namespace table { |
34 |
||
2069.4.4
by Brian Aker
Create a shared form of the instance which is a bit more heavier weight then |
35 |
namespace instance { |
36 |
class Shared; |
|
37 |
}
|
|
38 |
||
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
39 |
class Concurrent; |
40 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
41 |
typedef boost::unordered_multimap< identifier::Table::Key, Concurrent *> CacheMap; |
1877.2.6
by Brian Aker
Fixed header/etc. |
42 |
typedef std::pair< CacheMap::const_iterator, CacheMap::const_iterator > CacheRange; |
43 |
||
44 |
class Cache |
|
45 |
{
|
|
46 |
CacheMap cache; |
|
47 |
||
48 |
public: |
|
49 |
static inline Cache &singleton() |
|
50 |
{
|
|
51 |
static Cache open_cache; |
|
52 |
||
53 |
return open_cache; |
|
54 |
}
|
|
55 |
||
56 |
CacheMap &getCache() |
|
57 |
{
|
|
58 |
return cache; |
|
59 |
}
|
|
1877.2.7
by Brian Aker
Encapsulate more of the table cache. |
60 |
|
1910.2.13
by Brian Aker
Rehash the size on the actual table cache as well. |
61 |
void rehash(size_t arg) |
62 |
{
|
|
63 |
cache.rehash(arg); |
|
64 |
}
|
|
65 |
||
1877.2.7
by Brian Aker
Encapsulate more of the table cache. |
66 |
bool areTablesUsed(Table *table, bool wait_for_name_lock); |
2087.4.1
by Brian Aker
Merge in schema identifier. |
67 |
void removeSchema(const identifier::Schema &schema_identifier); |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
68 |
bool removeTable(Session *session, identifier::Table &identifier, uint32_t flags); |
2069.4.4
by Brian Aker
Create a shared form of the instance which is a bit more heavier weight then |
69 |
void release(table::instance::Shared *share); |
1903.1.1
by Brian Aker
Merge of partial set of patches for locks. |
70 |
bool insert(table::Concurrent *arg); |
1938.4.10
by Brian Aker
Convert LOCK_open to lock in mutex |
71 |
|
72 |
boost::mutex &mutex() |
|
73 |
{
|
|
74 |
return _mutex; |
|
75 |
}
|
|
76 |
||
77 |
private: |
|
78 |
boost::mutex _mutex; |
|
1877.2.6
by Brian Aker
Fixed header/etc. |
79 |
};
|
80 |
||
81 |
CacheMap &getCache(void); |
|
1877.2.4
by Brian Aker
Shift over to cache definition in table/cache |
82 |
void remove_table(table::Concurrent *arg); |
83 |
||
84 |
} /* namepsace table */ |
|
85 |
} /* namepsace drizzled */ |
|
86 |
||
87 |
#endif /* DRIZZLED_TABLE_CACHE_H */ |