|
MySQL 5.6.14 Source Code Document
|
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <errno.h>#include <sys/time.h>#include "innodb_api.h"#include "memcached/util.h"#include <innodb_cb_api.h>#include <innodb_config.h>
Go to the source code of this file.
Macros | |
| #define | UPDATE_ALL_VAL_COL -1 |
| #define | SET_EXP_TIME(exp) |
Functions | |
| void | register_innodb_cb (void *p) |
| ib_err_t | innodb_api_begin (innodb_engine_t *engine, const char *dbname, const char *name, innodb_conn_data_t *conn_data, ib_trx_t ib_trx, ib_crsr_t *crsr, ib_crsr_t *idx_crsr, ib_lck_mode_t lock_mode) |
| ib_err_t | innodb_api_search (innodb_conn_data_t *cursor_data, ib_crsr_t *crsr, const char *key, int len, mci_item_t *item, ib_tpl_t *r_tpl, bool sel_only) |
| uint64_t | mci_get_time (void) |
| ib_err_t | innodb_api_insert (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len, uint32_t val_len, uint64_t exp, uint64_t *cas, uint64_t flags) |
| ENGINE_ERROR_CODE | innodb_api_delete (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len) |
| ENGINE_ERROR_CODE | innodb_api_arithmetic (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len, int delta, bool increment, uint64_t *cas, rel_time_t exp_time __attribute__((unused)), bool create, uint64_t initial, uint64_t *out_result) |
| ENGINE_ERROR_CODE | innodb_api_store (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len, uint32_t val_len, uint64_t exp, uint64_t *cas, uint64_t input_cas, uint64_t flags, ENGINE_STORE_OPERATION op) |
| ENGINE_ERROR_CODE | innodb_api_flush (innodb_engine_t *engine, innodb_conn_data_t *conn_data, const char *dbname, const char *name) |
| bool | innodb_reset_conn (innodb_conn_data_t *conn_data, bool has_lock, bool commit, bool has_binlog) |
| void | innodb_api_cursor_reset (innodb_engine_t *engine, innodb_conn_data_t *conn_data, conn_op_type_t op_type, bool commit) |
| ib_err_t | innodb_cb_cursor_close (ib_crsr_t ib_crsr) |
| ib_err_t | innodb_cb_trx_commit (ib_trx_t ib_trx) |
| ib_err_t | innodb_cb_close_thd (void *thd) |
| ib_trx_t | innodb_cb_trx_begin (ib_trx_level_t ib_trx_level) |
| ib_err_t | innodb_cb_cursor_new_trx (ib_crsr_t ib_crsr, ib_trx_t ib_trx) |
| ib_err_t | innodb_cb_cursor_lock (innodb_engine_t *eng, ib_crsr_t ib_crsr, ib_lck_mode_t ib_lck_mode) |
| ib_tpl_t | innodb_cb_read_tuple_create (ib_crsr_t ib_crsr) |
| ib_err_t | innodb_cb_cursor_first (ib_crsr_t ib_crsr) |
| ib_err_t | innodb_cb_read_row (ib_crsr_t ib_crsr, ib_tpl_t ib_tpl) |
| ib_ulint_t | innodb_cb_col_get_meta (ib_tpl_t ib_tpl, ib_ulint_t i, ib_col_meta_t *ib_col_meta) |
| void | innodb_cb_tuple_delete (ib_tpl_t ib_tpl) |
| ib_ulint_t | innodb_cb_tuple_get_n_cols (const ib_tpl_t ib_tpl) |
| const void * | innodb_cb_col_get_value (ib_tpl_t ib_tpl, ib_ulint_t i) |
| ib_err_t | innodb_cb_open_table (const char *name, ib_trx_t ib_trx, ib_crsr_t *ib_crsr) |
| char * | innodb_cb_col_get_name (ib_crsr_t ib_crsr, ib_ulint_t i) |
| ib_err_t | innodb_cb_cursor_open_index_using_name (ib_crsr_t ib_open_crsr, const char *index_name, ib_crsr_t *ib_crsr, int *idx_type, ib_id_u64_t *idx_id) |
| int | innodb_cb_get_cfg () |
Variables | |
| option_t | config_option_names [] |
InnoDB APIs to support memcached commands
Created 04/12/2011 Jimmy Yang
Definition in file innodb_api.c.
| #define SET_EXP_TIME | ( | exp | ) |
Set expiration time. If the exp sent by client is larger than
60*60*24*30 (number of seconds in 30 days), it will be considered to be real Unix time value rather than an offset from current time
Definition at line 108 of file innodb_api.c.
| #define UPDATE_ALL_VAL_COL -1 |
Whether to update all columns' value or a specific column value
Definition at line 38 of file innodb_api.c.
| ENGINE_ERROR_CODE innodb_api_arithmetic | ( | innodb_engine_t * | engine, |
| innodb_conn_data_t * | cursor_data, | ||
| const char * | key, | ||
| int | len, | ||
| int | delta, | ||
| bool | increment, | ||
| uint64_t * | cas, | ||
| rel_time_t exp_time | __attribute__(unused), | ||
| bool | create, | ||
| uint64_t | initial, | ||
| uint64_t * | out_result | ||
| ) |
Update a row with arithmetic operations
| engine | in: InnoDB Memcached engine |
| cursor_data | in/out: cursor info |
| key | in: key value |
| len | in: key length |
| delta | in: value to add or subtract |
| increment | in: increment or decrement |
| cas | out: cas |
| __attribute__ | in: expire time |
| create | in: whether to create new entry if not found |
| initial | in: initialize value |
| out_result | in: arithmetic result |
Definition at line 1533 of file innodb_api.c.

| ib_err_t innodb_api_begin | ( | innodb_engine_t * | engine, |
| const char * | dbname, | ||
| const char * | name, | ||
| innodb_conn_data_t * | conn_data, | ||
| ib_trx_t | ib_trx, | ||
| ib_crsr_t * | crsr, | ||
| ib_crsr_t * | idx_crsr, | ||
| ib_lck_mode_t | lock_mode | ||
| ) |
Open a table and return a cursor for the table.
| engine | in: InnoDB Memcached engine |
| dbname | in: NUL terminated database name |
| name | in: NUL terminated table name |
| conn_data | in/out: connnection specific data |
| ib_trx | in: transaction |
| crsr | out: innodb cursor |
| idx_crsr | out: innodb index cursor |
| lock_mode | in: lock mode |
Definition at line 139 of file innodb_api.c.


| void innodb_api_cursor_reset | ( | innodb_engine_t * | engine, |
| innodb_conn_data_t * | conn_data, | ||
| conn_op_type_t | op_type, | ||
| bool | commit | ||
| ) |
Increment read and write counters, if they exceed the batch size, commit the transaction.
| engine | in: InnoDB Memcached engine |
| conn_data | in/out: cursor affiliated with a connection |
| op_type | in: type of DML performed |
| commit | in: commit or abort trx |
Definition at line 1984 of file innodb_api.c.

| ENGINE_ERROR_CODE innodb_api_delete | ( | innodb_engine_t * | engine, |
| innodb_conn_data_t * | cursor_data, | ||
| const char * | key, | ||
| int | len | ||
| ) |
Delete a row, support the memcached "remove" command
| engine | in: InnoDB Memcached engine |
| cursor_data | in/out: cursor info |
| key | in: value to insert |
| len | in: value length |
Definition at line 1367 of file innodb_api.c.

| ENGINE_ERROR_CODE innodb_api_flush | ( | innodb_engine_t * | engine, |
| innodb_conn_data_t * | conn_data, | ||
| const char * | dbname, | ||
| const char * | name | ||
| ) |
Implement the "flush_all" command, map to InnoDB's "trunk table" operation return ENGINE_SUCCESS is all successful
| engine | in: InnoDB Memcached engine |
| conn_data | in/out: cursor affiliated with a connection |
| dbname | in: database name |
| name | in: table name |
Definition at line 1842 of file innodb_api.c.

| ib_err_t innodb_api_insert | ( | innodb_engine_t * | engine, |
| innodb_conn_data_t * | cursor_data, | ||
| const char * | key, | ||
| int | len, | ||
| uint32_t | val_len, | ||
| uint64_t | exp, | ||
| uint64_t * | cas, | ||
| uint64_t | flags | ||
| ) |
Insert a row
| engine | in: InnoDB Memcached engine |
| cursor_data | in/out: cursor info |
| key | in: key and value to insert |
| len | in: key length |
| val_len | in: value length |
| exp | in: expiration time |
| cas | in/out: cas value |
| flags | in: flags |
Definition at line 1234 of file innodb_api.c.


| ib_err_t innodb_api_search | ( | innodb_conn_data_t * | cursor_data, |
| ib_crsr_t * | crsr, | ||
| const char * | key, | ||
| int | len, | ||
| mci_item_t * | item, | ||
| ib_tpl_t * | r_tpl, | ||
| bool | sel_only | ||
| ) |
Position a row according to the search key, and fetch value if needed
| cursor_data | in/out: cursor info |
| crsr | in/out: cursor used to search |
| key | in: key to search |
| len | in: key length |
| item | in: result |
| r_tpl | in: tpl for other DML operations |
| sel_only | in: for select only |
Definition at line 748 of file innodb_api.c.

| ENGINE_ERROR_CODE innodb_api_store | ( | innodb_engine_t * | engine, |
| innodb_conn_data_t * | cursor_data, | ||
| const char * | key, | ||
| int | len, | ||
| uint32_t | val_len, | ||
| uint64_t | exp, | ||
| uint64_t * | cas, | ||
| uint64_t | input_cas, | ||
| uint64_t | flags, | ||
| ENGINE_STORE_OPERATION | op | ||
| ) |
This is the main interface to following memcached commands: 1) add 2) replace 3) append 4) prepend 5) set 6) cas
| engine | in: InnoDB Memcached engine |
| cursor_data | in/out: cursor info |
| key | in: key value |
| len | in: key length |
| val_len | in: value length |
| exp | in: expire time |
| cas | out: cas value |
| input_cas | in: cas value supplied by user |
| flags | in: flags |
| op | in: Operations |
Definition at line 1727 of file innodb_api.c.

| ib_err_t innodb_cb_close_thd | ( | void * | thd | ) |
Close table associated to the connection
| thd | in: THD |
Definition at line 2059 of file innodb_api.c.
| ib_ulint_t innodb_cb_col_get_meta | ( | ib_tpl_t | ib_tpl, |
| ib_ulint_t | i, | ||
| ib_col_meta_t * | ib_col_meta | ||
| ) |
Get a column type, length and attributes from the tuple.
| ib_tpl | in: tuple instance |
| i | in: column index in tuple |
| ib_col_meta | out: column meta data |
Definition at line 2156 of file innodb_api.c.

| char* innodb_cb_col_get_name | ( | ib_crsr_t | ib_crsr, |
| ib_ulint_t | i | ||
| ) |
Get a column name from the tuple.
| ib_crsr | in: InnoDB cursor instance |
| i | in: column index in tuple |
Definition at line 2216 of file innodb_api.c.

| const void* innodb_cb_col_get_value | ( | ib_tpl_t | ib_tpl, |
| ib_ulint_t | i | ||
| ) |
Get a column value pointer from the tuple.
| ib_tpl | in: tuple instance |
| i | in: column index in tuple |
Definition at line 2191 of file innodb_api.c.
Following are a set of InnoDB callback function wrappers for functions
that will be used outside innodb_api.c Close a cursor
| ib_crsr | in/out: cursor to close |
Definition at line 2037 of file innodb_api.c.

Move cursor to the first record in the table.
| ib_crsr | in: InnoDB cursor instance |
Definition at line 2133 of file innodb_api.c.

| ib_err_t innodb_cb_cursor_lock | ( | innodb_engine_t * | eng, |
| ib_crsr_t | ib_crsr, | ||
| ib_lck_mode_t | ib_lck_mode | ||
| ) |
Set the Lock an InnoDB cursor/table.
| eng | in: InnoDB Memcached engine |
| ib_crsr | in/out: InnoDB cursor |
| ib_lck_mode | in: InnoDB lock mode |
Definition at line 2093 of file innodb_api.c.

update the cursor with new transactions and also reset the cursor
| ib_crsr | in/out: InnoDB cursor |
| ib_trx | in: transaction |
Definition at line 2081 of file innodb_api.c.
| ib_err_t innodb_cb_cursor_open_index_using_name | ( | ib_crsr_t | ib_open_crsr, |
| const char * | index_name, | ||
| ib_crsr_t * | ib_crsr, | ||
| int * | idx_type, | ||
| ib_id_u64_t * | idx_id | ||
| ) |
Open an InnoDB secondary index cursor and return a cursor handle to it.
| ib_open_crsr | in: open/active cursor |
| index_name | in: secondary index name |
| ib_crsr | out,own: InnoDB index cursor |
| idx_type | out: index is cluster index |
| idx_id | out: index id |
Definition at line 2228 of file innodb_api.c.

| int innodb_cb_get_cfg | ( | ) |
Get InnoDB API configure option
Definition at line 2243 of file innodb_api.c.
Open a table using the table name.
| name | in: table name to lookup |
| ib_trx | in: transaction |
| ib_crsr | in: cursor to be used |
Definition at line 2203 of file innodb_api.c.

Read current row.
| ib_crsr | in: InnoDB cursor instance |
| ib_tpl | out: read cols into this tuple |
Definition at line 2144 of file innodb_api.c.

Create an InnoDB tuple used for index/table search.
| ib_crsr | in: Cursor instance |
Definition at line 2122 of file innodb_api.c.

| ib_trx_t innodb_cb_trx_begin | ( | ib_trx_level_t | ib_trx_level | ) |
Start a transaction
| ib_trx_level | in: trx isolation level |
Definition at line 2070 of file innodb_api.c.

Commit the transaction
| ib_trx | in/out: transaction to commit |
Definition at line 2048 of file innodb_api.c.

| void innodb_cb_tuple_delete | ( | ib_tpl_t | ib_tpl | ) |
Destroy an InnoDB tuple.
| ib_tpl | in,own: Tuple instance to delete |
Definition at line 2168 of file innodb_api.c.

| ib_ulint_t innodb_cb_tuple_get_n_cols | ( | const ib_tpl_t | ib_tpl | ) |
Return the number of columns in the tuple definition.
| ib_tpl | in: Tuple for table/index |
Definition at line 2180 of file innodb_api.c.

| bool innodb_reset_conn | ( | innodb_conn_data_t * | conn_data, |
| bool | has_lock, | ||
| bool | commit, | ||
| bool | has_binlog | ||
| ) |
Increment read and write counters, if they exceed the batch size, commit the transaction.
| conn_data | in/out: cursor affiliated with a connection |
| has_lock | in: has lock on connection |
| commit | in: commit or abort trx |
| has_binlog | in: binlog enabled |
Definition at line 1878 of file innodb_api.c.


| uint64_t mci_get_time | ( | void | ) |
| void register_innodb_cb | ( | void * | p | ) |
Register InnoDB Callback functions
| p | in: Pointer to callback function array |
Definition at line 118 of file innodb_api.c.
| option_t config_option_names[] |
Configure options enum IDs, their "names" and their default value
Definition at line 38 of file innodb_config.c.