~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« 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-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

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
 
 *
6
4
 *  Copyright (C) 2008 Sun Microsystems, Toru Maesaka
 
5
 *  Copyright (C) 2010 Djellel Eddine Difallah
7
6
 *
8
7
 *  This program is free software; you can redistribute it and/or modify
9
8
 *  it under the terms of the GNU General Public License as published by
22
21
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
23
22
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
24
23
 
 
24
#include "drizzled/plugin.h"
25
25
#include "drizzled/plugin/plugin.h"
 
26
#include <drizzled/sql_list.h>
26
27
 
 
28
namespace drizzled
 
29
{
27
30
class Session;
 
31
class select_result;
28
32
 
29
 
namespace drizzled
30
 
{
31
33
namespace plugin
32
34
{
33
35
 
34
36
/* 
35
37
  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
38
*/
 
39
 
43
40
class QueryCache : public Plugin
44
41
{
 
42
private:  
 
43
  
45
44
  QueryCache();
46
45
  QueryCache(const QueryCache &);
47
46
  QueryCache& operator=(const QueryCache &);
48
 
public:
 
47
 
 
48
public:  
 
49
 
49
50
  explicit QueryCache(std::string name_arg)
50
51
    : Plugin(name_arg, "QueryCache")
51
52
  {}
52
53
 
53
54
  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;
 
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;
63
68
 
64
69
  static bool addPlugin(QueryCache *handler);
65
70
  static void removePlugin(QueryCache *handler);
66
71
 
67
72
  /* 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);
 
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);
74
78
};
75
79
 
76
80
} /* namespace plugin */