~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/blackhole/ha_blackhole.h

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2005 MySQL AB
2
 
 
3
 
  This program is free software; you can redistribute it and/or modify
4
 
  it under the terms of the GNU General Public License as published by
5
 
  the Free Software Foundation; version 2 of the License.
6
 
 
7
 
  This program is distributed in the hope that it will be useful,
8
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 
  GNU General Public License for more details.
11
 
 
12
 
  You should have received a copy of the GNU General Public License
13
 
  along with this program; if not, write to the Free Software
14
 
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
 
 
16
 
 
17
 
#ifndef PLUGIN_BLACKHOLE_HA_BLACKHOLE_H
18
 
#define PLUGIN_BLACKHOLE_HA_BLACKHOLE_H
19
 
 
20
 
#include <drizzled/cursor.h>
21
 
#include <drizzled/thr_lock.h>
22
 
 
23
 
#define BLACKHOLE_MAX_KEY       64              /* Max allowed keys */
24
 
#define BLACKHOLE_MAX_KEY_LENGTH 1000
25
 
 
26
 
/*
27
 
  Shared structure for correct LOCK operation
28
 
*/
29
 
class BlackholeShare
30
 
{
31
 
  BlackholeShare();
32
 
  BlackholeShare(const BlackholeShare &);
33
 
  BlackholeShare& operator=(const BlackholeShare &);
34
 
public:
35
 
  explicit BlackholeShare(const std::string table_name_arg);
36
 
  ~BlackholeShare();
37
 
  drizzled::THR_LOCK lock;
38
 
  uint32_t use_count;
39
 
  const std::string table_name;
40
 
};
41
 
 
42
 
 
43
 
/*
44
 
  Class definition for the blackhole storage engine
45
 
  "Dumbest named feature ever"
46
 
*/
47
 
class ha_blackhole: public drizzled::Cursor
48
 
{
49
 
  drizzled::THR_LOCK_DATA lock;      /* MySQL lock */
50
 
  BlackholeShare *share;
51
 
 
52
 
public:
53
 
  ha_blackhole(drizzled::plugin::StorageEngine &engine,
54
 
               drizzled::Table &table_arg);
55
 
  ~ha_blackhole()
56
 
  {}
57
 
 
58
 
  /*
59
 
    The name of the index type that will be used for display
60
 
    don't implement this method unless you really have indexes
61
 
  */
62
 
  const char *index_type(uint32_t key_number);
63
 
  uint32_t index_flags(uint32_t inx) const;
64
 
  int open(const char *name, int mode, uint32_t test_if_locked);
65
 
  int close(void);
66
 
  int doInsertRecord(unsigned char * buf);
67
 
  int doStartTableScan(bool scan);
68
 
  int rnd_next(unsigned char *buf);
69
 
  int rnd_pos(unsigned char * buf, unsigned char *pos);
70
 
  BlackholeShare *get_share(const char *table_name);
71
 
  void free_share();
72
 
  int index_read_map(unsigned char * buf, const unsigned char * key,
73
 
                     drizzled::key_part_map keypart_map,
74
 
                     drizzled::ha_rkey_function find_flag);
75
 
  int index_read_idx_map(unsigned char * buf, uint32_t idx, const unsigned char * key,
76
 
                         drizzled::key_part_map keypart_map,
77
 
                         drizzled::ha_rkey_function find_flag);
78
 
  int index_read_last_map(unsigned char * buf, const unsigned char * key,
79
 
                          drizzled::key_part_map keypart_map);
80
 
  int index_next(unsigned char * buf);
81
 
  int index_prev(unsigned char * buf);
82
 
  int index_first(unsigned char * buf);
83
 
  int index_last(unsigned char * buf);
84
 
  void position(const unsigned char *record);
85
 
  int info(uint32_t flag);
86
 
 
87
 
  void get_auto_increment(uint64_t, uint64_t,
88
 
                          uint64_t,
89
 
                          uint64_t *,
90
 
                          uint64_t *)
91
 
  {}
92
 
 
93
 
};
94
 
 
95
 
#endif /* PLUGIN_BLACKHOLE_HA_BLACKHOLE_H */