~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/heap_priv.h

retrieve data from the local cache

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 "config.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 "drizzled/internal/my_sys.h"
 
24
#include "drizzled/charset_info.h"
 
25
#include "drizzled/internal/my_pthread.h"
26
26
#include "heap.h"                       /* Structs & some defines */
27
 
#include <drizzled/tree.h>
 
27
#include "drizzled/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.
39
37
 
40
38
#define CHUNK_STATUS_DELETED 0    /* this chunk has been deleted and can be reused */
41
39
#define CHUNK_STATUS_ACTIVE  1    /* this chunk represents the first part of a live record */
 
40
#define CHUNK_STATUS_LINKED  2    /* this chunk is a continuation from another chunk (part of chunkset) */
42
41
 
43
42
        /* Some extern variables */
44
43
 
47
46
 
48
47
#define test_active(info) \
49
48
if (!(info->update & HA_STATE_AKTIV))\
50
 
{ errno= drizzled::HA_ERR_NO_ACTIVE_RECORD; return(-1); }
 
49
{ errno=HA_ERR_NO_ACTIVE_RECORD; return(-1); }
51
50
#define hp_find_hash(A,B) ((HASH_INFO*) hp_find_block((A),(B)))
52
51
 
53
52
        /* Find pos for record and update it in info->current_ptr */
54
 
#define hp_find_record(info,pos) (info)->current_ptr= hp_find_block(&(info)->getShare()->recordspace.block,pos)
 
53
#define hp_find_record(info,pos) (info)->current_ptr= hp_find_block(&(info)->s->recordspace.block,pos)
55
54
 
56
55
#define get_chunk_status(info,ptr) (ptr[(info)->offset_status])
57
56
 
 
57
#define get_chunk_count(info,rec_length) ((rec_length + (info)->chunk_dataspace_length - 1) / (info)->chunk_dataspace_length)
 
58
 
58
59
typedef struct st_hp_hash_info
59
60
{
60
61
  struct st_hp_hash_info *next_key;
61
62
  unsigned char *ptr_to_rec;
62
63
} HASH_INFO;
63
64
 
 
65
typedef struct {
 
66
  HA_KEYSEG *keyseg;
 
67
  uint32_t key_length;
 
68
  uint32_t search_flag;
 
69
} heap_rb_param;
 
70
 
64
71
        /* Prototypes for intern functions */
65
72
 
66
73
extern HP_SHARE *hp_find_named_heap(const char *name);
69
76
extern int hp_get_new_block(HP_BLOCK *info, size_t* alloc_length);
70
77
extern void hp_free(HP_SHARE *info);
71
78
extern unsigned char *hp_free_level(HP_BLOCK *block,uint32_t level,HP_PTRS *pos,
72
 
                                    unsigned char *last_pos);
 
79
                           unsigned char *last_pos);
73
80
extern int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
74
81
                        const unsigned char *record, unsigned char *recpos);
 
82
extern int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
 
83
                           const unsigned char *record, unsigned char *recpos);
 
84
extern int hp_rb_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
 
85
                            const unsigned char *record,unsigned char *recpos,int flag);
75
86
extern int hp_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo,
76
87
                         const unsigned char *record,unsigned char *recpos,int flag);
77
88
extern HASH_INFO *_heap_find_hash(HP_BLOCK *block,uint32_t pos);
87
98
                          const unsigned char *rec2,
88
99
                          bool diff_if_only_endspace_difference);
89
100
extern void hp_make_key(HP_KEYDEF *keydef,unsigned char *key,const unsigned char *rec);
 
101
extern uint32_t hp_rb_make_key(HP_KEYDEF *keydef, unsigned char *key,
 
102
                           const unsigned char *rec, unsigned char *recpos);
 
103
extern uint32_t hp_rb_key_length(HP_KEYDEF *keydef, const unsigned char *key);
 
104
extern uint32_t hp_rb_null_key_length(HP_KEYDEF *keydef, const unsigned char *key);
 
105
extern uint32_t hp_rb_var_key_length(HP_KEYDEF *keydef, const unsigned char *key);
90
106
extern bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const unsigned char *record);
91
107
extern int hp_close(HP_INFO *info);
92
108
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);
93
112
 
94
113
   /* Chunkset management (alloc/free/encode/decode) functions */
95
114
 
96
115
extern unsigned char *hp_allocate_chunkset(HP_DATASPACE *info, uint32_t chunk_count);
 
116
extern int hp_reallocate_chunkset(HP_DATASPACE *info, uint32_t chunk_count, unsigned char* pos);
97
117
extern void hp_free_chunks(HP_DATASPACE *info, unsigned char *pos);
98
118
extern void hp_clear_dataspace(HP_DATASPACE *info);
99
119
 
100
120
extern uint32_t hp_get_encoded_data_length(HP_SHARE *info, const unsigned char *record, uint32_t *chunk_count);
101
121
extern void hp_copy_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos);
102
122
extern void hp_extract_record(HP_SHARE *info, unsigned char *record, const unsigned char *pos);
103
 
extern bool hp_compare_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos);
104
 
 
105
 
extern boost::mutex THR_LOCK_heap;
106
 
 
107
 
#endif /* PLUGIN_MEMORY_HEAP_PRIV_H */
 
123
extern uint32_t hp_process_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos, uint32_t is_compare);
 
124
 
 
125
 
 
126
 
 
127
extern pthread_mutex_t THR_LOCK_heap;
 
128
 
 
129
#endif /* PLUGIN_HEAP_HEAP_PRIV_H */