~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/heap.h

  • Committer: Monty Taylor
  • Date: 2009-09-30 07:01:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1184.
  • Revision ID: mordred@inaugust.com-20090930070132-b1ol1xu1rpajdddy
Small namespace cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
/* This file should be included when using heap_database_functions */
17
17
/* Author: Michael Widenius */
18
18
 
19
 
#ifndef _heap_h
20
 
#define _heap_h
 
19
#ifndef PLUGIN_HEAP_HEAP_H
 
20
#define PLUGIN_HEAP_HEAP_H
 
21
 
21
22
#ifdef  __cplusplus
22
23
extern "C" {
23
24
#endif
27
28
#include <mysys/my_pthread.h>
28
29
#include <mysys/thr_lock.h>
29
30
 
30
 
#include <storage/myisam/my_handler.h>
 
31
#include <plugin/myisam/my_handler.h>
31
32
#include <mysys/my_tree.h>
32
33
 
33
34
        /* defines used by heap-funktions */
61
62
{
62
63
  /* Number of unused slots in *last_blocks HP_PTRS block (0 for 0th level) */
63
64
  uint32_t free_ptrs_in_block;
64
 
  
 
65
 
65
66
  /*
66
67
    Maximum number of records that can be 'contained' inside of each element
67
 
    of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for 
 
68
    of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for
68
69
    level 2 - HP_PTRS_IN_NOD^2 and so forth.
69
70
  */
70
71
  uint32_t records_under_level;
71
72
 
72
73
  /*
73
 
    Ptr to last allocated HP_PTRS (or records buffer for level 0) on this 
 
74
    Ptr to last allocated HP_PTRS (or records buffer for level 0) on this
74
75
    level.
75
76
  */
76
 
  HP_PTRS *last_blocks;                 
 
77
  HP_PTRS *last_blocks;
77
78
};
78
79
 
79
80
 
83
84
  is recbuffer bytes.
84
85
  The internal representation is as follows:
85
86
  HP_BLOCK is a hierarchical structure of 'blocks'.
86
 
  A block at level 0 is an array records_in_block records. 
87
 
  A block at higher level is an HP_PTRS structure with pointers to blocks at 
 
87
  A block at level 0 is an array records_in_block records.
 
88
  A block at higher level is an HP_PTRS structure with pointers to blocks at
88
89
  lower levels.
89
90
  At the highest level there is one top block. It is stored in HP_BLOCK::root.
90
91
 
91
 
  See hp_find_block for a description of how record pointer is obtained from 
 
92
  See hp_find_block for a description of how record pointer is obtained from
92
93
  its index.
93
 
  See hp_get_new_block 
 
94
  See hp_get_new_block
94
95
*/
95
96
 
96
97
typedef struct st_heap_block
97
98
{
98
 
  HP_PTRS *root;                        /* Top-level block */ 
 
99
  HP_PTRS *root;                        /* Top-level block */
99
100
  struct st_level_info level_info[HP_MAX_LEVELS+1];
100
101
  uint32_t levels;                          /* number of used levels */
101
102
  uint32_t records_in_block;            /* Records in one heap-block */
117
118
    Number of buckets used in hash table. Used only to provide
118
119
    #records estimates for heap key scans.
119
120
  */
120
 
  ha_rows hash_buckets; 
 
121
  ha_rows hash_buckets;
121
122
  TREE rb_tree;
122
123
  int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
123
124
                   const unsigned char *record, unsigned char *recpos);
135
136
  uint16_t null_pos;                    /* position for null marker */
136
137
  uint8_t  length_bytes;  /* length of the size, 1 o 2 bytes */
137
138
} HP_COLUMNDEF;
138
 
 
 
139
 
139
140
typedef struct st_heap_dataspace   /* control data for data space */
140
141
{
141
142
  HP_BLOCK block;
170
171
  uint32_t currently_disabled_keys;    /* saved value from "keys" when disabled */
171
172
  uint32_t open_count;
172
173
 
173
 
  
 
174
 
174
175
  char * name;                  /* Name of "memory-file" */
175
176
  THR_LOCK lock;
176
177
  pthread_mutex_t intern_lock;          /* Locking for use with _locking */
177
178
  bool delete_on_close;
178
 
  LIST open_list;
179
179
  uint32_t auto_key;
180
180
  uint32_t auto_key_type;                       /* real type of the auto key segment */
181
181
  uint64_t auto_increment;
200
200
  uint32_t lastkey_len;
201
201
  bool implicit_emptied;
202
202
  THR_LOCK_DATA lock;
203
 
  LIST open_list;
204
203
} HP_INFO;
205
204
 
206
205
 
209
208
  uint32_t auto_key;                        /* keynr [1 - maxkey] for auto key */
210
209
  uint32_t auto_key_type;
211
210
  uint32_t max_chunk_size;
212
 
  uint32_t is_dynamic;  
 
211
  uint32_t is_dynamic;
213
212
  uint64_t max_table_size;
214
213
  uint64_t auto_increment;
215
214
  bool with_auto_increment;
266
265
   pointer to rows where a long instead of a (unsigned char*).
267
266
*/
268
267
 
269
 
#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION)
270
 
extern int heap_rrnd_old(HP_INFO *info,unsigned char *buf,uint32_t pos);
271
 
extern uint32_t heap_position_old(HP_INFO *info);
272
 
#endif
273
 
#ifdef OLD_HEAP_VERSION
274
 
typedef uint32_t HEAP_PTR;
275
 
#define heap_position(A) heap_position_old(A)
276
 
#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C)
277
 
#else
278
268
typedef unsigned char *HEAP_PTR;
279
 
#endif
280
269
 
281
270
#ifdef  __cplusplus
282
271
}
283
272
#endif
284
 
#endif
 
273
 
 
274
#endif /* PLUGIN_HEAP_HEAP_H */