~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to drizzled/plugin/query_cache.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

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
 *  Definitions required for Query Cache plugin
 
5
 *
 
6
 *  Copyright (C) 2008 Sun Microsystems, Toru Maesaka
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; version 2 of the License.
 
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_PLUGIN_QUERY_CACHE_H
 
23
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
 
24
 
 
25
#include "drizzled/plugin/plugin.h"
 
26
 
 
27
class Session;
 
28
 
 
29
namespace drizzled
 
30
{
 
31
namespace plugin
 
32
{
 
33
 
 
34
/* 
 
35
  This is the API that a qcache plugin must implement.
 
36
  it should implement each of these function pointers.
 
37
  if a function pointer is NULL (not loaded), that's ok.
 
38
 
 
39
  Return:
 
40
    false = success
 
41
    true  = failure
 
42
*/
 
43
class QueryCache : public Plugin
 
44
{
 
45
  QueryCache();
 
46
  QueryCache(const QueryCache &);
 
47
  QueryCache& operator=(const QueryCache &);
 
48
public:
 
49
  explicit QueryCache(std::string name_arg)
 
50
    : Plugin(name_arg, "QueryCache")
 
51
  {}
 
52
 
 
53
  virtual ~QueryCache() {}
 
54
  /* Lookup the cache and transmit the data back to the client */
 
55
  virtual bool tryFetchAndSend(Session *session,
 
56
                               bool is_transactional)= 0;
 
57
 
 
58
  virtual bool set(Session *session, bool is_transactional)= 0;
 
59
  virtual bool invalidateTable(Session *session, bool is_transactional)= 0;
 
60
  virtual bool invalidateDb(Session *session, const char *db_name,
 
61
                            bool transactional)= 0;
 
62
  virtual bool flush(Session *session)= 0;
 
63
 
 
64
  static bool addPlugin(QueryCache *handler);
 
65
  static void removePlugin(QueryCache *handler);
 
66
 
 
67
  /* These are the functions called by the rest of the Drizzle server */
 
68
  static bool tryFetchAndSendDo(Session *session, bool transactional);
 
69
  static bool setDo(Session *session, bool transactional);
 
70
  static bool invalidateTableDo(Session *session, bool transactional);
 
71
  static bool invalidateDbDo(Session *session, const char *db_name,
 
72
                            bool transactional);
 
73
  static bool flushDo(Session *session);
 
74
};
 
75
 
 
76
} /* namespace plugin */
 
77
} /* namespace drizzled */
 
78
 
 
79
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */