~drizzle-trunk/drizzle/development

1122.2.10 by Monty Taylor
Fixed all of the include guards.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
499.2.10 by Mark Atwood
add editor format hints, and other useful metadata comments
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
1122.2.10 by Monty Taylor
Fixed all of the include guards.
3
 *
1643.6.5 by Djellel E. Difallah
retrieve data from the local cache
4
 *  Copyright (C) 2008 Sun Microsystems, Toru Maesaka
5
 *  Copyright (C) 2010 Djellel Eddine Difallah
499.2.10 by Mark Atwood
add editor format hints, and other useful metadata comments
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; version 2 of the License.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
520.2.2 by Mark Atwood
new plugin types, configvar and qcache
20
968.2.37 by Monty Taylor
Converted qcache plugin.
21
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
22
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
520.2.2 by Mark Atwood
new plugin types, configvar and qcache
23
1643.6.1 by Djellel E. Difallah
Added hook points and the interface for the Query Cache plugin
24
#include "drizzled/plugin.h"
1237.9.3 by Padraig O'Sullivan
Removed one the includes I put in server_includes.h for the last commit to get rid of the inclusion
25
#include "drizzled/plugin/plugin.h"
1643.6.1 by Djellel E. Difallah
Added hook points and the interface for the Query Cache plugin
26
#include <drizzled/sql_list.h>
1237.9.3 by Padraig O'Sullivan
Removed one the includes I put in server_includes.h for the last commit to get rid of the inclusion
27
1324.2.3 by Monty Taylor
Remove plugin deinit.
28
namespace drizzled
29
{
1241.9.26 by Monty Taylor
Removed forward declares from server_includes.h
30
class Session;
1643.6.1 by Djellel E. Difallah
Added hook points and the interface for the Query Cache plugin
31
class select_result;
1241.9.26 by Monty Taylor
Removed forward declares from server_includes.h
32
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
33
namespace plugin
34
{
35
772.1.1 by Toru Maesaka
Defined the first version of the Query Cache interface.
36
/* 
37
  This is the API that a qcache plugin must implement.
38
*/
1643.6.5 by Djellel E. Difallah
retrieve data from the local cache
39
1130.2.5 by Monty Taylor
Some carnage. I'm sure it'll need fixed.
40
class QueryCache : public Plugin
520.2.2 by Mark Atwood
new plugin types, configvar and qcache
41
{
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
42
private:  
43
  
1130.2.5 by Monty Taylor
Some carnage. I'm sure it'll need fixed.
44
  QueryCache();
45
  QueryCache(const QueryCache &);
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
46
  QueryCache& operator=(const QueryCache &);
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
47
48
public:  
49
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
50
  explicit QueryCache(std::string name_arg)
1192.2.5 by Monty Taylor
Replaced overridable virtual methods with passing name to constructor. Now individual plugins will not be allowed to set their own plugin type name. :)
51
    : Plugin(name_arg, "QueryCache")
1130.2.16 by Monty Taylor
Cleaned up the constructor initializer lists per Brian.
52
  {}
968.2.37 by Monty Taylor
Converted qcache plugin.
53
54
  virtual ~QueryCache() {}
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
55
1643.6.1 by Djellel E. Difallah
Added hook points and the interface for the Query Cache plugin
56
  /* these are the Query Cache interface functions */
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
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;
1643.6.1 by Djellel E. Difallah
Added hook points and the interface for the Query Cache plugin
62
  /* Send the current Resultset to the cache */
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
63
  virtual bool doSetResultset(Session *session)= 0;
1643.6.1 by Djellel E. Difallah
Added hook points and the interface for the Query Cache plugin
64
  /* initiate a new Resultset (header) */
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
65
  virtual bool doPrepareResultset(Session *session)= 0;
1643.6.1 by Djellel E. Difallah
Added hook points and the interface for the Query Cache plugin
66
  /* push a record to the current Resultset */
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
67
  virtual bool doInsertRecord(Session *session, List<Item> &item)= 0;
68
1130.1.19 by Monty Taylor
Added error reporting to plugin registration.
69
  static bool addPlugin(QueryCache *handler);
1130.1.18 by Monty Taylor
Changed ::add() and ::remove() to ::addPlugin() and ::removePlugin() so that
70
  static void removePlugin(QueryCache *handler);
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
71
72
  /* These are the functions called by the rest of the Drizzle server */
1643.6.3 by Djellel E. Difallah
Refactoring of the QC Plugin's interface methods, adding mutual exclusion mechanism between sessions to cache a query, Store Meta inoformation of all the tables and select fields of the query
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);
968.2.37 by Monty Taylor
Converted qcache plugin.
78
};
79
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
80
} /* namespace plugin */
81
} /* namespace drizzled */
82
968.2.37 by Monty Taylor
Converted qcache plugin.
83
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */