~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/query_cache.h

  • Committer: Brian Aker
  • Date: 2010-08-09 18:04:12 UTC
  • mfrom: (1689.3.7 staging)
  • Revision ID: brian@gaz-20100809180412-olurwh51ojllev6p
Merge in heap conversion, and case insensitive patch, and remove need for
M_HASH in session.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
 
4
 *  Definitions required for Query Cache plugin
 
5
 *
4
6
 *  Copyright (C) 2008 Sun Microsystems, Toru Maesaka
5
 
 *  Copyright (C) 2010 Djellel Eddine Difallah
6
7
 *
7
8
 *  This program is free software; you can redistribute it and/or modify
8
9
 *  it under the terms of the GNU General Public License as published by
21
22
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
22
23
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
23
24
 
24
 
#include <drizzled/plugin.h>
25
 
#include <drizzled/plugin/plugin.h>
26
 
#include <drizzled/sql_list.h>
27
 
 
28
 
#include <drizzled/visibility.h>
 
25
#include "drizzled/plugin/plugin.h"
29
26
 
30
27
namespace drizzled
31
28
{
32
29
class Session;
33
 
class select_result;
34
30
 
35
31
namespace plugin
36
32
{
37
33
 
38
34
/* 
39
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
40
42
*/
41
 
 
42
 
class DRIZZLED_API QueryCache : public Plugin
 
43
class QueryCache : public Plugin
43
44
{
44
 
private:  
45
 
  
46
45
  QueryCache();
47
46
  QueryCache(const QueryCache &);
48
47
  QueryCache& operator=(const QueryCache &);
49
 
 
50
 
public:  
51
 
 
 
48
public:
52
49
  explicit QueryCache(std::string name_arg)
53
50
    : Plugin(name_arg, "QueryCache")
54
51
  {}
55
52
 
56
53
  virtual ~QueryCache() {}
57
 
 
58
 
  /* these are the Query Cache interface functions */
59
 
 
60
 
  /* Lookup the cache and transmit the data back to the client */
61
 
  virtual bool doIsCached(Session* session)= 0;  
62
 
  /* Lookup the cache and transmit the data back to the client */
63
 
  virtual bool doSendCachedResultset(Session *session)= 0;
64
 
  /* Send the current Resultset to the cache */
65
 
  virtual bool doSetResultset(Session *session)= 0;
66
 
  /* initiate a new Resultset (header) */
67
 
  virtual bool doPrepareResultset(Session *session)= 0;
68
 
  /* push a record to the current Resultset */
69
 
  virtual bool doInsertRecord(Session *session, List<Item> &item)= 0;
 
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;
70
63
 
71
64
  static bool addPlugin(QueryCache *handler);
72
65
  static void removePlugin(QueryCache *handler);
73
66
 
74
67
  /* These are the functions called by the rest of the Drizzle server */
75
 
  static bool isCached(Session *session);
76
 
  static bool sendCachedResultset(Session *session);
77
 
  static bool prepareResultset(Session *session);
78
 
  static bool setResultset(Session *session);
79
 
  static bool insertRecord(Session *session, List<Item> &item);
 
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);
80
74
};
81
75
 
82
76
} /* namespace plugin */