~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/ha_myisam.h

  • Committer: Brian Aker
  • Date: 2009-01-24 09:43:35 UTC
  • Revision ID: brian@gir-3.local-20090124094335-6qdtvc35gl5fvivz
Adding in an example singe thread scheduler

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
 
#ifndef PLUGIN_MYISAM_HA_MYISAM_H
18
 
#define PLUGIN_MYISAM_HA_MYISAM_H
19
 
 
20
 
#include <drizzled/cursor.h>
21
 
#include <drizzled/thr_lock.h>
22
 
 
23
 
/* class for the the myisam Cursor */
24
 
 
25
 
#include <plugin/myisam/myisam.h>
26
 
 
27
 
class ha_myisam: public drizzled::Cursor
 
17
#ifndef STORAGE_MYISAM_HA_MYISAM_H
 
18
#define STORAGE_MYISAM_HA_MYISAM_H
 
19
 
 
20
#include <drizzled/handler.h>
 
21
#include <mysys/thr_lock.h>
 
22
 
 
23
/* class for the the myisam handler */
 
24
 
 
25
#include <storage/myisam/myisam.h>
 
26
 
 
27
#define HA_RECOVER_NONE         0       /* No automatic recover */
 
28
#define HA_RECOVER_DEFAULT      1       /* Automatic recover active */
 
29
#define HA_RECOVER_BACKUP       2       /* Make a backupfile on recover */
 
30
#define HA_RECOVER_FORCE        4       /* Recover even if we loose rows */
 
31
#define HA_RECOVER_QUICK        8       /* Don't check rows in data file */
 
32
 
 
33
extern TYPELIB myisam_recover_typelib;
 
34
extern ulong myisam_recover_options;
 
35
 
 
36
#ifdef __cplusplus
 
37
extern "C" {
 
38
#endif
 
39
 
 
40
bool index_cond_func_myisam(void *arg);
 
41
 
 
42
#ifdef __cplusplus
 
43
}
 
44
#endif
 
45
 
 
46
class ha_myisam: public handler
28
47
{
29
48
  MI_INFO *file;
 
49
  uint64_t int_table_flags;
30
50
  char    *data_file_name, *index_file_name;
31
51
  bool can_enable_indexes;
32
 
  bool is_ordered;
33
 
  int repair(drizzled::Session *session, MI_CHECK &param, bool optimize);
 
52
  int repair(Session *session, MI_CHECK &param, bool optimize);
34
53
 
35
54
 public:
36
 
  ha_myisam(drizzled::plugin::StorageEngine &engine,
37
 
            drizzled::TableShare &table_arg);
 
55
  ha_myisam(handlerton *hton, TABLE_SHARE *table_arg);
38
56
  ~ha_myisam() {}
39
 
  Cursor *clone(drizzled::memory::Root *mem_root);
 
57
  handler *clone(MEM_ROOT *mem_root);
 
58
  const char *table_type() const { return "MyISAM"; }
40
59
  const char *index_type(uint32_t key_number);
 
60
  const char **bas_ext() const;
 
61
  uint64_t table_flags() const { return int_table_flags; }
41
62
  int index_init(uint32_t idx, bool sorted);
42
63
  int index_end();
 
64
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
 
65
  uint32_t max_supported_keys()          const { return MI_MAX_KEY; }
 
66
  uint32_t max_supported_key_length()    const { return MI_MAX_KEY_LENGTH; }
 
67
  uint32_t max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; }
43
68
  uint32_t checksum() const;
44
69
 
45
70
  int open(const char *name, int mode, uint32_t test_if_locked);
47
72
  int write_row(unsigned char * buf);
48
73
  int update_row(const unsigned char * old_data, unsigned char * new_data);
49
74
  int delete_row(const unsigned char * buf);
50
 
  int index_read_map(unsigned char *buf, const unsigned char *key, drizzled::key_part_map keypart_map,
51
 
                     enum drizzled::ha_rkey_function find_flag);
 
75
  int index_read_map(unsigned char *buf, const unsigned char *key, key_part_map keypart_map,
 
76
                     enum ha_rkey_function find_flag);
52
77
  int index_read_idx_map(unsigned char *buf, uint32_t index, const unsigned char *key,
53
 
                         drizzled::key_part_map keypart_map,
54
 
                         enum drizzled::ha_rkey_function find_flag);
55
 
  int index_read_last_map(unsigned char *buf, const unsigned char *key, drizzled::key_part_map keypart_map);
 
78
                         key_part_map keypart_map,
 
79
                         enum ha_rkey_function find_flag);
 
80
  int index_read_last_map(unsigned char *buf, const unsigned char *key, key_part_map keypart_map);
56
81
  int index_next(unsigned char * buf);
57
82
  int index_prev(unsigned char * buf);
58
83
  int index_first(unsigned char * buf);
64
89
  int restart_rnd_next(unsigned char *buf, unsigned char *pos);
65
90
  void position(const unsigned char *record);
66
91
  int info(uint);
67
 
  int extra(enum drizzled::ha_extra_function operation);
68
 
  int extra_opt(enum drizzled::ha_extra_function operation, uint32_t cache_size);
 
92
  int extra(enum ha_extra_function operation);
 
93
  int extra_opt(enum ha_extra_function operation, uint32_t cache_size);
69
94
  int reset(void);
70
 
  int external_lock(drizzled::Session *session, int lock_type);
 
95
  int external_lock(Session *session, int lock_type);
71
96
  int delete_all_rows(void);
72
97
  int disable_indexes(uint32_t mode);
73
98
  int enable_indexes(uint32_t mode);
74
99
  int indexes_are_disabled(void);
75
 
  void start_bulk_insert(drizzled::ha_rows rows);
 
100
  void start_bulk_insert(ha_rows rows);
76
101
  int end_bulk_insert();
77
 
  drizzled::ha_rows records_in_range(uint32_t inx, drizzled::key_range *min_key, drizzled::key_range *max_key);
 
102
  ha_rows records_in_range(uint32_t inx, key_range *min_key, key_range *max_key);
 
103
  void update_create_info(HA_CREATE_INFO *create_info);
 
104
  int create(const char *name, Table *form, HA_CREATE_INFO *create_info);
 
105
  THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
 
106
                             enum thr_lock_type lock_type);
78
107
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
79
108
                                  uint64_t nb_desired_values,
80
109
                                  uint64_t *first_value,
81
110
                                  uint64_t *nb_reserved_values);
 
111
  int rename_table(const char * from, const char * to);
 
112
  int delete_table(const char *name);
 
113
  int check(Session* session, HA_CHECK_OPT* check_opt);
 
114
  int analyze(Session* session,HA_CHECK_OPT* check_opt);
 
115
  int repair(Session* session, HA_CHECK_OPT* check_opt);
 
116
  bool check_and_repair(Session *session);
 
117
  bool is_crashed() const;
 
118
  bool auto_repair() const { return myisam_recover_options != 0; }
 
119
  int optimize(Session* session, HA_CHECK_OPT* check_opt);
 
120
  int assign_to_keycache(Session* session, HA_CHECK_OPT* check_opt);
 
121
  bool check_if_incompatible_data(HA_CREATE_INFO *info, uint32_t table_changes);
 
122
#ifdef HAVE_QUERY_CACHE
 
123
  bool register_query_cache_table(Session *session, char *table_key,
 
124
                                     uint32_t key_length,
 
125
                                     qc_engine_callback
 
126
                                     *engine_callback,
 
127
                                     uint64_t *engine_data);
 
128
#endif
82
129
  MI_INFO *file_ptr(void)
83
130
  {
84
131
    return file;
85
132
  }
86
 
  int read_range_first(const drizzled::key_range *start_key, const drizzled::key_range *end_key,
 
133
  int read_range_first(const key_range *start_key, const key_range *end_key,
87
134
                       bool eq_range_arg, bool sorted);
88
135
  int read_range_next();
89
 
  int reset_auto_increment(uint64_t value);
90
 
 
91
 
  virtual bool isOrdered(void)
92
 
  {
93
 
    return false;
94
 
  }
95
 
 
 
136
public:
 
137
  /**
 
138
   * Multi Range Read interface
 
139
   */
 
140
  int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
 
141
                            uint32_t n_ranges, uint32_t mode, HANDLER_BUFFER *buf);
 
142
  int multi_range_read_next(char **range_info);
 
143
  ha_rows multi_range_read_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
 
144
                                      void *seq_init_param,
 
145
                                      uint32_t n_ranges, uint32_t *bufsz,
 
146
                                      uint32_t *flags, COST_VECT *cost);
 
147
  int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys,
 
148
                            uint32_t *bufsz, uint32_t *flags, COST_VECT *cost);
 
149
 
 
150
  /* Index condition pushdown implementation */
 
151
  Item *idx_cond_push(uint32_t keyno, Item* idx_cond);
 
152
  bool check_if_supported_virtual_columns(void) { return true; }
96
153
private:
97
 
  drizzled::key_map keys_with_parts;
 
154
  DsMrr_impl ds_mrr;
 
155
  key_map keys_with_parts;
 
156
  friend bool index_cond_func_myisam(void *arg);
98
157
};
99
158
 
100
 
#endif /* PLUGIN_MYISAM_HA_MYISAM_H */
 
159
#endif /* STORAGE_MYISAM_HA_MYISAM_H */