| 1 |
#ifdef USE_PRAGMA_INTERFACE |
| 2 |
#pragma interface /* gcc class implementation */ |
| 3 |
#endif |
| 4 |
|
| 5 |
#include <senna/senna.h> |
| 6 |
|
| 7 |
typedef struct st_tritonn_db { |
| 8 |
char *db_name; |
| 9 |
uint db_name_length; |
| 10 |
sen_db *db; |
| 11 |
st_tritonn_db *next; |
| 12 |
} TRITONN_DB; |
| 13 |
|
| 14 |
/** @brief |
| 15 |
TRITONN_SHARE is a structure that will be shared among all open handlers. |
| 16 |
This implements the minimum of what you will probably need. |
| 17 |
*/ |
| 18 |
typedef struct st_tritonn_share { |
| 19 |
char *table_name; |
| 20 |
char *short_name; |
| 21 |
uint table_name_length,use_count; |
| 22 |
pthread_mutex_t mutex; |
| 23 |
THR_LOCK lock; |
| 24 |
} TRITONN_SHARE; |
| 25 |
|
| 26 |
class ha_tritonn: public handler |
| 27 |
{ |
| 28 |
THR_LOCK_DATA lock; // MySQL lock |
| 29 |
TRITONN_SHARE *share; // Shared lock info |
| 30 |
sen_ctx *ctx; |
| 31 |
|
| 32 |
public: |
| 33 |
/* constructor */ |
| 34 |
ha_tritonn(handlerton *hton, TABLE_SHARE *table_arg); |
| 35 |
/* destructor */ |
| 36 |
~ha_tritonn(); |
| 37 |
/* engine name */ |
| 38 |
const char *table_type() const; |
| 39 |
/* index type in string for specified number */ |
| 40 |
const char *index_type(uint inx) const; |
| 41 |
/* file extantion for storage */ |
| 42 |
const char **bas_ext() const; |
| 43 |
|
| 44 |
// see $MYSQL_SRC/sql/handler.h "bits in table_flags" |
| 45 |
ulonglong table_flags() const; |
| 46 |
|
| 47 |
// see $MYSQL_SRC/sql/handler.h, "bits in index_flags" |
| 48 |
ulong index_flags(uint inx, uint part, bool all_parts) const; |
| 49 |
|
| 50 |
/* add index */ |
| 51 |
int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); |
| 52 |
|
| 53 |
/* drop index */ |
| 54 |
int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys); |
| 55 |
int final_drop_index(TABLE *table_arg); |
| 56 |
|
| 57 |
/* open table */ |
| 58 |
int open(const char *name, int mode, uint test_if_locked); |
| 59 |
/* close table */ |
| 60 |
int close(void); |
| 61 |
|
| 62 |
int rnd_init(bool scan); // required |
| 63 |
int rnd_next(uchar *buf); // required |
| 64 |
int rnd_pos(uchar *buf, uchar *pos); // required |
| 65 |
void position(const uchar *record); // required |
| 66 |
int info(uint); // required |
| 67 |
int create(const char *name, TABLE *form, |
| 68 |
HA_CREATE_INFO *create_info); // required |
| 69 |
const COND *cond_push(const COND *cond); // condition pushdown |
| 70 |
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, |
| 71 |
enum thr_lock_type lock_type); // required |
| 72 |
uint max_supported_keys() const; |
| 73 |
uint max_supported_key_length() const; |
| 74 |
uint max_supported_key_part_length() const; |
| 75 |
int write_row(uchar *buf); |
| 76 |
}; |
| 77 |
|
| 78 |
#ifdef DEBUG_TRITONN |
| 79 |
#define DBTN printf("[DBTN] %s#%s:%d\n",__FUNCTION__,__FILE__,__LINE__) |
| 80 |
#define DBTN2(x) printf("[DBTN2] %s#%s:%d msg=%s\n",__FUNCTION__,__FILE__,__LINE__,x) |
| 81 |
#else |
| 82 |
#define DBTN |
| 83 |
#define DBTN2(x) |
| 84 |
#endif |