~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/heapdef.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
/* This file is included in all heap-files */
17
 
#ifndef PLUGIN_HEAP_HEAP_PRIV_H
18
 
#define PLUGIN_HEAP_HEAP_PRIV_H
 
17
#ifndef HEAPDEF_H
 
18
#define HEAPDEF_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"
28
 
#include <list>
 
27
#include <mysys/my_tree.h>
29
28
 
30
29
/*
31
30
  When allocating keys /rows in the internal block structure, do it
35
34
  as possible and keep memory consumption down.
36
35
*/
37
36
 
 
37
#ifdef __cplusplus
 
38
extern "C" {
 
39
#endif
 
40
 
 
41
#define HP_MIN_RECORDS_IN_BLOCK 16
 
42
#define HP_MAX_RECORDS_IN_BLOCK 8192
 
43
 
38
44
#define CHUNK_STATUS_DELETED 0    /* this chunk has been deleted and can be reused */
39
45
#define CHUNK_STATUS_ACTIVE  1    /* this chunk represents the first part of a live record */
40
46
#define CHUNK_STATUS_LINKED  2    /* this chunk is a continuation from another chunk (part of chunkset) */
41
47
 
42
48
        /* Some extern variables */
43
49
 
44
 
extern std::list<HP_SHARE *> heap_share_list;
45
 
extern std::list<HP_INFO *> heap_open_list;
 
50
extern LIST *heap_open_list,*heap_share_list;
46
51
 
47
52
#define test_active(info) \
48
53
if (!(info->update & HA_STATE_AKTIV))\
49
 
{ errno=HA_ERR_NO_ACTIVE_RECORD; return(-1); }
 
54
{ my_errno=HA_ERR_NO_ACTIVE_RECORD; return(-1); }
50
55
#define hp_find_hash(A,B) ((HASH_INFO*) hp_find_block((A),(B)))
51
56
 
52
57
        /* Find pos for record and update it in info->current_ptr */
90
95
                       uint32_t nextflag);
91
96
extern unsigned char *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo,
92
97
                            const unsigned char *key, HASH_INFO *pos);
 
98
extern uint32_t hp_hashnr(HP_KEYDEF *keyinfo,const unsigned char *key);
93
99
extern uint32_t hp_rec_hashnr(HP_KEYDEF *keyinfo,const unsigned char *rec);
94
100
extern uint32_t hp_mask(uint32_t hashnr,uint32_t buffmax,uint32_t maxlength);
95
101
extern void hp_movelink(HASH_INFO *pos,HASH_INFO *next_link,
97
103
extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const unsigned char *rec1,
98
104
                          const unsigned char *rec2,
99
105
                          bool diff_if_only_endspace_difference);
 
106
extern int hp_key_cmp(HP_KEYDEF *keydef,const unsigned char *rec,
 
107
                      const unsigned char *key);
100
108
extern void hp_make_key(HP_KEYDEF *keydef,unsigned char *key,const unsigned char *rec);
101
109
extern uint32_t hp_rb_make_key(HP_KEYDEF *keydef, unsigned char *key,
102
110
                           const unsigned char *rec, unsigned char *recpos);
104
112
extern uint32_t hp_rb_null_key_length(HP_KEYDEF *keydef, const unsigned char *key);
105
113
extern uint32_t hp_rb_var_key_length(HP_KEYDEF *keydef, const unsigned char *key);
106
114
extern bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const unsigned char *record);
107
 
extern int hp_close(HP_INFO *info);
 
115
extern int hp_close(register HP_INFO *info);
108
116
extern void hp_clear(HP_SHARE *info);
109
 
extern uint32_t hp_rb_pack_key(HP_KEYDEF *keydef,
110
 
                               unsigned char *key, const unsigned char *old,
111
 
                               drizzled::key_part_map keypart_map);
 
117
extern void hp_clear_keys(HP_SHARE *info);
 
118
extern uint32_t hp_rb_pack_key(HP_KEYDEF *keydef, unsigned char *key, const unsigned char *old,
 
119
                           key_part_map keypart_map);
112
120
 
113
121
   /* Chunkset management (alloc/free/encode/decode) functions */
114
122
 
126
134
 
127
135
extern pthread_mutex_t THR_LOCK_heap;
128
136
 
129
 
#endif /* PLUGIN_HEAP_HEAP_PRIV_H */
 
137
#ifdef __cplusplus
 
138
}
 
139
#endif
 
140
 
 
141
#endif /* HEAPDEF_H */