1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2002, 2004 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
14 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
1
by brian
clean slate |
15 |
|
16 |
/* This file is included in all heap-files */
|
|
1758.2.2
by patrick crews
Fixed issues that were breaking make distcheck. IFDEF's were using PLUGIN_HEAP vs. PLUGIN MEMORY |
17 |
#ifndef PLUGIN_MEMORY_HEAP_PRIV_H
|
18 |
#define PLUGIN_MEMORY_HEAP_PRIV_H
|
|
1
by brian
clean slate |
19 |
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
20 |
#include "config.h" |
612.2.13
by Monty Taylor
Work on removing global.h from headers that should be installed. |
21 |
#include <drizzled/base.h> |
22 |
||
1241.9.64
by Monty Taylor
Moved remaining non-public portions of mysys and mystrings to drizzled/internal. |
23 |
#include "drizzled/internal/my_sys.h" |
1241.9.61
by Monty Taylor
No more mystrings in drizzled/ |
24 |
#include "drizzled/charset_info.h" |
1241.9.64
by Monty Taylor
Moved remaining non-public portions of mysys and mystrings to drizzled/internal. |
25 |
#include "drizzled/internal/my_pthread.h" |
1
by brian
clean slate |
26 |
#include "heap.h" /* Structs & some defines */ |
1410.3.4
by Djellel E. Difallah
update references to old my_'s |
27 |
#include "drizzled/tree.h" |
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
28 |
#include <list> |
1
by brian
clean slate |
29 |
|
1689.3.6
by Brian Aker
Update for HEAP to convert its lock to boost. |
30 |
#include <boost/thread/mutex.hpp> |
31 |
||
1
by brian
clean slate |
32 |
/*
|
33 |
When allocating keys /rows in the internal block structure, do it
|
|
34 |
within the following boundaries.
|
|
35 |
||
36 |
The challenge is to find the balance between allocate as few blocks
|
|
37 |
as possible and keep memory consumption down.
|
|
38 |
*/
|
|
39 |
||
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
40 |
#define CHUNK_STATUS_DELETED 0 /* this chunk has been deleted and can be reused */ |
41 |
#define CHUNK_STATUS_ACTIVE 1 /* this chunk represents the first part of a live record */ |
|
42 |
#define CHUNK_STATUS_LINKED 2 /* this chunk is a continuation from another chunk (part of chunkset) */ |
|
43 |
||
1
by brian
clean slate |
44 |
/* Some extern variables */
|
45 |
||
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
46 |
extern std::list<HP_SHARE *> heap_share_list; |
47 |
extern std::list<HP_INFO *> heap_open_list; |
|
1
by brian
clean slate |
48 |
|
49 |
#define test_active(info) \
|
|
50 |
if (!(info->update & HA_STATE_AKTIV))\
|
|
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
51 |
{ errno=HA_ERR_NO_ACTIVE_RECORD; return(-1); }
|
1
by brian
clean slate |
52 |
#define hp_find_hash(A,B) ((HASH_INFO*) hp_find_block((A),(B)))
|
53 |
||
54 |
/* Find pos for record and update it in info->current_ptr */
|
|
1697.2.1
by Brian Aker
Encapsulate the internal share for HEAP. |
55 |
#define hp_find_record(info,pos) (info)->current_ptr= hp_find_block(&(info)->getShare()->recordspace.block,pos)
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
56 |
|
57 |
#define get_chunk_status(info,ptr) (ptr[(info)->offset_status])
|
|
58 |
||
59 |
#define get_chunk_count(info,rec_length) ((rec_length + (info)->chunk_dataspace_length - 1) / (info)->chunk_dataspace_length)
|
|
1
by brian
clean slate |
60 |
|
61 |
typedef struct st_hp_hash_info |
|
62 |
{
|
|
63 |
struct st_hp_hash_info *next_key; |
|
481
by Brian Aker
Remove all of uchar. |
64 |
unsigned char *ptr_to_rec; |
1
by brian
clean slate |
65 |
} HASH_INFO; |
66 |
||
67 |
/* Prototypes for intern functions */
|
|
68 |
||
69 |
extern HP_SHARE *hp_find_named_heap(const char *name); |
|
481
by Brian Aker
Remove all of uchar. |
70 |
extern int hp_rectest(HP_INFO *info,const unsigned char *old); |
71 |
extern unsigned char *hp_find_block(HP_BLOCK *info,uint32_t pos); |
|
1
by brian
clean slate |
72 |
extern int hp_get_new_block(HP_BLOCK *info, size_t* alloc_length); |
73 |
extern void hp_free(HP_SHARE *info); |
|
482
by Brian Aker
Remove uint. |
74 |
extern unsigned char *hp_free_level(HP_BLOCK *block,uint32_t level,HP_PTRS *pos, |
1749.3.2
by Brian Aker
Remove dead rb calls. |
75 |
unsigned char *last_pos); |
1
by brian
clean slate |
76 |
extern int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, |
481
by Brian Aker
Remove all of uchar. |
77 |
const unsigned char *record, unsigned char *recpos); |
1
by brian
clean slate |
78 |
extern int hp_delete_key(HP_INFO *info,HP_KEYDEF *keyinfo, |
481
by Brian Aker
Remove all of uchar. |
79 |
const unsigned char *record,unsigned char *recpos,int flag); |
291
by Brian Aker
Head ulong conversion. |
80 |
extern HASH_INFO *_heap_find_hash(HP_BLOCK *block,uint32_t pos); |
481
by Brian Aker
Remove all of uchar. |
81 |
extern unsigned char *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const unsigned char *key, |
482
by Brian Aker
Remove uint. |
82 |
uint32_t nextflag); |
481
by Brian Aker
Remove all of uchar. |
83 |
extern unsigned char *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, |
84 |
const unsigned char *key, HASH_INFO *pos); |
|
85 |
extern uint32_t hp_rec_hashnr(HP_KEYDEF *keyinfo,const unsigned char *rec); |
|
291
by Brian Aker
Head ulong conversion. |
86 |
extern uint32_t hp_mask(uint32_t hashnr,uint32_t buffmax,uint32_t maxlength); |
1
by brian
clean slate |
87 |
extern void hp_movelink(HASH_INFO *pos,HASH_INFO *next_link, |
88 |
HASH_INFO *newlink); |
|
481
by Brian Aker
Remove all of uchar. |
89 |
extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const unsigned char *rec1, |
90 |
const unsigned char *rec2, |
|
280
by Brian Aker
Removed my_bool from heap engine. |
91 |
bool diff_if_only_endspace_difference); |
481
by Brian Aker
Remove all of uchar. |
92 |
extern void hp_make_key(HP_KEYDEF *keydef,unsigned char *key,const unsigned char *rec); |
93 |
extern bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const unsigned char *record); |
|
916.1.27
by Padraig O'Sullivan
Removing the declaration of a variable as register. Is this really needed |
94 |
extern int hp_close(HP_INFO *info); |
1
by brian
clean slate |
95 |
extern void hp_clear(HP_SHARE *info); |
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
96 |
|
97 |
/* Chunkset management (alloc/free/encode/decode) functions */
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
98 |
|
482
by Brian Aker
Remove uint. |
99 |
extern unsigned char *hp_allocate_chunkset(HP_DATASPACE *info, uint32_t chunk_count); |
481
by Brian Aker
Remove all of uchar. |
100 |
extern void hp_free_chunks(HP_DATASPACE *info, unsigned char *pos); |
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
101 |
extern void hp_clear_dataspace(HP_DATASPACE *info); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
102 |
|
482
by Brian Aker
Remove uint. |
103 |
extern uint32_t hp_get_encoded_data_length(HP_SHARE *info, const unsigned char *record, uint32_t *chunk_count); |
481
by Brian Aker
Remove all of uchar. |
104 |
extern void hp_copy_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos); |
105 |
extern void hp_extract_record(HP_SHARE *info, unsigned char *record, const unsigned char *pos); |
|
1749.3.8
by Brian Aker
Cleaned up name of calls around datachunk |
106 |
extern bool hp_compare_record_data_to_chunkset(HP_SHARE *info, const unsigned char *record, unsigned char *pos); |
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
107 |
|
1689.3.6
by Brian Aker
Update for HEAP to convert its lock to boost. |
108 |
extern boost::mutex THR_LOCK_heap; |
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
109 |
|
1758.2.2
by patrick crews
Fixed issues that were breaking make distcheck. IFDEF's were using PLUGIN_HEAP vs. PLUGIN MEMORY |
110 |
#endif /* PLUGIN_MEMORY_HEAP_PRIV_H */ |