~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/heap_priv.h

Merge Stewart's dead code removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
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 */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* This file is included in all heap-files */
17
 
#ifndef PLUGIN_MEMORY_HEAP_PRIV_H
18
 
#define PLUGIN_MEMORY_HEAP_PRIV_H
 
17
#ifndef PLUGIN_HEAP_HEAP_PRIV_H
 
18
#define PLUGIN_HEAP_HEAP_PRIV_H
19
19
 
20
 
#include "config.h"
 
20
#include <drizzled/global.h>
21
21
#include <drizzled/base.h>
22
22
 
23
 
#include "drizzled/internal/my_sys.h"
24
 
#include "drizzled/charset_info.h"
25
 
#include "drizzled/internal/my_pthread.h"
 
23
#include <mysys/my_sys.h>
 
24
#include <mystrings/m_ctype.h>
 
25
#include <mysys/my_pthread.h>
26
26
#include "heap.h"                       /* Structs & some defines */
27
 
#include "drizzled/tree.h"
 
27
#include <mysys/my_tree.h>
28
28
#include <list>
29
29
 
30
 
#include <boost/thread/mutex.hpp>
31
 
 
32
30
/*
33
31
  When allocating keys /rows in the internal block structure, do it
34
32
  within the following boundaries.
37
35
  as possible and keep memory consumption down.
38
36
*/
39
37
 
 
38
#ifdef __cplusplus
 
39
extern "C" {
 
40
#endif
 
41
 
40
42
#define CHUNK_STATUS_DELETED 0    /* this chunk has been deleted and can be reused */
41
43
#define CHUNK_STATUS_ACTIVE  1    /* this chunk represents the first part of a live record */
42
44
#define CHUNK_STATUS_LINKED  2    /* this chunk is a continuation from another chunk (part of chunkset) */
48
50
 
49
51
#define test_active(info) \
50
52
if (!(info->update & HA_STATE_AKTIV))\
51
 
{ errno= drizzled::HA_ERR_NO_ACTIVE_RECORD; return(-1); }
 
53
{ my_errno=HA_ERR_NO_ACTIVE_RECORD; return(-1); }
52
54
#define hp_find_hash(A,B) ((HASH_INFO*) hp_find_block((A),(B)))
53
55
 
54
56
        /* Find pos for record and update it in info->current_ptr */
55
 
#define hp_find_record(info,pos) (info)->current_ptr= hp_find_block(&(info)->getShare()->recordspace.block,pos)
 
57
#define hp_find_record(info,pos) (info)->current_ptr= hp_find_block(&(info)->s->recordspace.block,pos)
56
58
 
57
59
#define get_chunk_status(info,ptr) (ptr[(info)->offset_status])
58
60
 
64
66
  unsigned char *ptr_to_rec;
65
67
} HASH_INFO;
66
68
 
 
69
typedef struct {
 
70
  HA_KEYSEG *keyseg;
 
71
  uint32_t key_length;
 
72
  uint32_t search_flag;
 
73
} heap_rb_param;
 
74
 
67
75
        /* Prototypes for intern functions */
68
76
 
69
77
extern HP_SHARE *hp_find_named_heap(const char *name);
72
80
extern int hp_get_new_block(HP_BLOCK *info, size_t* alloc_length);
73
81
extern void hp_free(HP_SHARE *info);
74
82
extern unsigned char *hp_free_level(HP_BLOCK *block,uint32_t level,HP_PTRS *pos,
75
 
                                    unsigned char *last_pos);
 
83
                           unsigned char *last_pos);
76
84
extern int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
77
85
                        const unsigned char *record, unsigned char *recpos);
 
86
extern int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
 
87
                           const unsigned char *record, unsigned char *recpos);
 
88
extern int hp_rb_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
 
89
                            const unsigned char *record,unsigned char *recpos,int flag);
78
90
extern int hp_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
79
91
                         const unsigned char *record,unsigned char *recpos,int flag);
80
92
extern HASH_INFO *_heap_find_hash(HP_BLOCK *block,uint32_t pos);
90
102
                          const unsigned char *rec2,
91
103
                          bool diff_if_only_endspace_difference);
92
104
extern void hp_make_key(HP_KEYDEF *keydef,unsigned char *key,const unsigned char *rec);
 
105
extern uint32_t hp_rb_make_key(HP_KEYDEF *keydef, unsigned char *key,
 
106
                           const unsigned char *rec, unsigned char *recpos);
 
107
extern uint32_t hp_rb_key_length(HP_KEYDEF *keydef, const unsigned char *key);
 
108
extern uint32_t hp_rb_null_key_length(HP_KEYDEF *keydef, const unsigned char *key);
 
109
extern uint32_t hp_rb_var_key_length(HP_KEYDEF *keydef, const unsigned char *key);
93
110
extern bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const unsigned char *record);
94
111
extern int hp_close(HP_INFO *info);
95
112
extern void hp_clear(HP_SHARE *info);
 
113
extern uint32_t hp_rb_pack_key(HP_KEYDEF *keydef, unsigned char *key, const unsigned char *old,
 
114
                           key_part_map keypart_map);
96
115
 
97
116
   /* Chunkset management (alloc/free/encode/decode) functions */
98
117
 
99
118
extern unsigned char *hp_allocate_chunkset(HP_DATASPACE *info, uint32_t chunk_count);
 
119
extern int hp_reallocate_chunkset(HP_DATASPACE *info, uint32_t chunk_count, unsigned char* pos);
100
120
extern void hp_free_chunks(HP_DATASPACE *info, unsigned char *pos);
101
121
extern void hp_clear_dataspace(HP_DATASPACE *info);
102
122
 
103
123
extern uint32_t hp_get_encoded_data_length(HP_SHARE *info, const unsigned char *record, uint32_t *chunk_count);
104
124
extern void hp_copy_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos);
105
125
extern void hp_extract_record(HP_SHARE *info, unsigned char *record, const unsigned char *pos);
106
 
extern bool hp_compare_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos);
107
 
 
108
 
extern boost::mutex THR_LOCK_heap;
109
 
 
110
 
#endif /* PLUGIN_MEMORY_HEAP_PRIV_H */
 
126
extern uint32_t hp_process_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos, uint32_t is_compare);
 
127
 
 
128
 
 
129
 
 
130
extern pthread_mutex_t THR_LOCK_heap;
 
131
 
 
132
#ifdef __cplusplus
 
133
}
 
134
#endif
 
135
 
 
136
#endif /* PLUGIN_HEAP_HEAP_PRIV_H */