1 #ifndef _DB_H
2 #define _DB_H
3 
4 #include <stdint.h>
5 #include <sys/types.h>
6 
7 typedef struct __toku_dbt DBT;
8 
9 // port: this is currently not used
10 struct simple_dbt {
11   uint32_t len;
12   void *data;
13 };
14 
15 // engine status info
16 // engine status is passed to handlerton as an array of
17 // TOKU_ENGINE_STATUS_ROW_S[]
18 typedef enum {
19   STATUS_FS_STATE = 0,  // interpret as file system state (redzone) enum
20   STATUS_UINT64,        // interpret as uint64_t
21   STATUS_CHARSTR,       // interpret as char *
22   STATUS_UNIXTIME,      // interpret as time_t
23   STATUS_TOKUTIME,      // interpret as tokutime_t
24   STATUS_PARCOUNT,      // interpret as PARTITIONED_COUNTER
25   STATUS_DOUBLE         // interpret as double
26 } toku_engine_status_display_type;
27 
28 typedef enum {
29   TOKU_ENGINE_STATUS = (1ULL << 0),  // Include when asking for engine status
30   TOKU_GLOBAL_STATUS =
31       (1ULL << 1),  // Include when asking for information_schema.global_status
32 } toku_engine_status_include_type;
33 
34 typedef struct __toku_engine_status_row {
35   const char *keyname;  // info schema key, should not change across revisions
36                         // without good reason
37   const char
38       *columnname;  // column for mysql, e.g. information_schema.global_status.
39                     // TOKUDB_ will automatically be prefixed.
40   const char *legend;  // the text that will appear at user interface
41   toku_engine_status_display_type type;  // how to interpret the value
42   toku_engine_status_include_type
43       include;  // which kinds of callers should get read this row?
44   union {
45     double dnum;
46     uint64_t num;
47     const char *str;
48     char datebuf[26];
49     struct partitioned_counter *parcount;
50   } value;
51 } * TOKU_ENGINE_STATUS_ROW, TOKU_ENGINE_STATUS_ROW_S;
52 
53 #define DB_BUFFER_SMALL -30999
54 #define DB_LOCK_DEADLOCK -30995
55 #define DB_LOCK_NOTGRANTED -30994
56 #define DB_NOTFOUND -30989
57 #define DB_KEYEXIST -30996
58 #define DB_DBT_MALLOC 8
59 #define DB_DBT_REALLOC 64
60 #define DB_DBT_USERMEM 256
61 
62 /* PerconaFT specific error codes */
63 #define TOKUDB_OUT_OF_LOCKS -100000
64 
65 typedef void (*lock_wait_callback)(void *arg, uint64_t requesting_txnid,
66                                    uint64_t blocking_txnid);
67 
68 struct __toku_dbt {
69   void *data;
70   size_t size;
71   size_t ulen;
72   // One of DB_DBT_XXX flags
73   uint32_t flags;
74 };
75 
76 #endif
77