~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/query_cache.h

Style cleanup

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
25
namespace drizzled
29
26
{
30
 
class Session;
31
 
class select_result;
32
 
 
33
27
namespace plugin
34
28
{
35
29
 
36
30
/* 
37
31
  This is the API that a qcache plugin must implement.
 
32
  it should implement each of these function pointers.
 
33
  if a function pointer is NULL (not loaded), that's ok.
 
34
 
 
35
  Return:
 
36
    false = success
 
37
    true  = failure
38
38
*/
39
 
 
40
39
class QueryCache : public Plugin
41
40
{
42
 
private:  
43
 
  
44
41
  QueryCache();
45
42
  QueryCache(const QueryCache &);
46
43
  QueryCache& operator=(const QueryCache &);
47
 
 
48
 
public:  
49
 
 
 
44
public:
50
45
  explicit QueryCache(std::string name_arg)
51
 
    : Plugin(name_arg, "QueryCache")
 
46
    : Plugin(name_arg)
52
47
  {}
53
48
 
54
49
  virtual ~QueryCache() {}
55
 
 
56
 
  /* these are the Query Cache interface functions */
57
 
 
58
 
  /* Lookup the cache and transmit the data back to the client */
59
 
  virtual bool doIsCached(Session* session)= 0;  
60
 
  /* Lookup the cache and transmit the data back to the client */
61
 
  virtual bool doSendCachedResultset(Session *session)= 0;
62
 
  /* Send the current Resultset to the cache */
63
 
  virtual bool doSetResultset(Session *session)= 0;
64
 
  /* initiate a new Resultset (header) */
65
 
  virtual bool doPrepareResultset(Session *session)= 0;
66
 
  /* push a record to the current Resultset */
67
 
  virtual bool doInsertRecord(Session *session, List<Item> &item)= 0;
 
50
  /* Lookup the cache and transmit the data back to the client */
 
51
  virtual bool tryFetchAndSend(Session *session,
 
52
                               bool is_transactional)= 0;
 
53
 
 
54
  virtual bool set(Session *session, bool is_transactional)= 0;
 
55
  virtual bool invalidateTable(Session *session, bool is_transactional)= 0;
 
56
  virtual bool invalidateDb(Session *session, const char *db_name,
 
57
                            bool transactional)= 0;
 
58
  virtual bool flush(Session *session)= 0;
68
59
 
69
60
  static bool addPlugin(QueryCache *handler);
70
61
  static void removePlugin(QueryCache *handler);
71
62
 
72
63
  /* These are the functions called by the rest of the Drizzle server */
73
 
  static bool isCached(Session *session);
74
 
  static bool sendCachedResultset(Session *session);
75
 
  static bool prepareResultset(Session *session);
76
 
  static bool setResultset(Session *session);
77
 
  static bool insertRecord(Session *session, List<Item> &item);
 
64
  static bool tryFetchAndSendDo(Session *session, bool transactional);
 
65
  static bool setDo(Session *session, bool transactional);
 
66
  static bool invalidateTableDo(Session *session, bool transactional);
 
67
  static bool invalidateDbDo(Session *session, const char *db_name,
 
68
                            bool transactional);
 
69
  static bool flushDo(Session *session);
78
70
};
79
71
 
80
72
} /* namespace plugin */