CUBRID Engine  latest
shard_proxy_handler.h File Reference
#include "porting.h"
#include "shard_proxy_common.h"
Include dependency graph for shard_proxy_handler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int(* T_PROXY_EVENT_FUNC) (char *driver_info, char **buffer)
 
typedef int(* T_PROXY_EVENT_FUNC_EX) (char *driver_info, char **buffer, void *argv)
 

Functions

T_WAIT_CONTEXTproxy_waiter_new (int ctx_cid, unsigned int ctx_uid, int timeout)
 
void proxy_waiter_free (T_WAIT_CONTEXT *waiter)
 
void proxy_waiter_timeout (T_SHARD_QUEUE *waitq, INT64 *counter, int now)
 
int proxy_waiter_comp_fn (const void *arg1, const void *arg2)
 
bool proxy_handler_is_cas_in_tran (int shard_id, int cas_id)
 
void proxy_context_set_error (T_PROXY_CONTEXT *ctx_p, int error_ind, int error_code)
 
void proxy_context_set_error_with_msg (T_PROXY_CONTEXT *ctx_p, int error_ind, int error_code, const char *error_msg)
 
void proxy_context_clear_error (T_PROXY_CONTEXT *ctx_p)
 
int proxy_context_send_error (T_PROXY_CONTEXT *ctx_p)
 
void proxy_context_set_in_tran (T_PROXY_CONTEXT *ctx_p, int shard_id, int cas_id)
 
void proxy_context_set_out_tran (T_PROXY_CONTEXT *ctx_p)
 
T_PROXY_CONTEXTproxy_context_new (void)
 
void proxy_context_free (T_PROXY_CONTEXT *ctx_p)
 
T_PROXY_CONTEXTproxy_context_find (int cid, unsigned int uid)
 
T_PROXY_CONTEXTproxy_context_find_by_socket_client_io (T_SOCKET_IO *sock_io_p)
 
T_CONTEXT_STMTproxy_context_find_stmt (T_PROXY_CONTEXT *ctx_p, int stmt_h_id)
 
T_CONTEXT_STMTproxy_context_add_stmt (T_PROXY_CONTEXT *ctx_p, T_SHARD_STMT *stmt_p)
 
void proxy_context_free_stmt (T_PROXY_CONTEXT *ctx_p)
 
void proxy_context_timeout (T_PROXY_CONTEXT *ctx_p)
 
char * proxy_str_context (T_PROXY_CONTEXT *ctx_p)
 
void proxy_handler_destroy (void)
 
int proxy_handler_initialize (void)
 
void proxy_handler_process (void)
 
int proxy_wakeup_context_by_shard (T_WAIT_CONTEXT *waiter_p, int shard_id, int cas_id)
 
int proxy_wakeup_context_by_statement (T_WAIT_CONTEXT *waiter_p)
 
T_PROXY_EVENTproxy_event_new (unsigned int type, int from_cas)
 
T_PROXY_EVENTproxy_event_dup (T_PROXY_EVENT *event_p)
 
T_PROXY_EVENTproxy_event_new_with_req (char *driver_info, unsigned int type, int from, T_PROXY_EVENT_FUNC req_func)
 
T_PROXY_EVENTproxy_event_new_with_rsp (char *driver_info, unsigned int type, int from, T_PROXY_EVENT_FUNC resp_func)
 
T_PROXY_EVENTproxy_event_new_with_rsp_ex (char *driver_info, unsigned int type, int from, T_PROXY_EVENT_FUNC_EX resp_func, void *argv)
 
T_PROXY_EVENTproxy_event_new_with_error (char *driver_info, unsigned int type, int from, int(*err_func)(char *driver_info, char **buffer, int error_ind, int error_code, const char *error_msg, char is_in_tran), int error_ind, int error_code, const char *error_msg, char is_in_tran)
 
int proxy_event_alloc_buffer (T_PROXY_EVENT *event_p, unsigned int size)
 
int proxy_event_realloc_buffer (T_PROXY_EVENT *event_p, unsigned int size)
 
void proxy_event_set_buffer (T_PROXY_EVENT *event_p, char *data, unsigned int size)
 
void proxy_event_set_type_from (T_PROXY_EVENT *event_p, unsigned int type, int from_cas)
 
void proxy_event_set_context (T_PROXY_EVENT *event_p, int cid, unsigned int uid)
 
void proxy_event_set_shard (T_PROXY_EVENT *event_p, int shard_id, int cas_id)
 
bool proxy_event_io_read_complete (T_PROXY_EVENT *event_p)
 
void proxy_event_free (T_PROXY_EVENT *event_p)
 
char * proxy_str_event (T_PROXY_EVENT *event_p)
 
void proxy_timer_process (void)
 
char * shard_str_sqls (char *sql)
 

Typedef Documentation

typedef int(* T_PROXY_EVENT_FUNC) (char *driver_info, char **buffer)

Definition at line 34 of file shard_proxy_handler.h.

typedef int(* T_PROXY_EVENT_FUNC_EX) (char *driver_info, char **buffer, void *argv)

Definition at line 35 of file shard_proxy_handler.h.

Function Documentation

void proxy_context_clear_error ( T_PROXY_CONTEXT ctx_p)
T_CONTEXT_STMT* proxy_context_find_stmt ( T_PROXY_CONTEXT ctx_p,
int  stmt_h_id 
)

Definition at line 1354 of file shard_proxy_handler.c.

References t_context_stmt::next, NULL, t_context_stmt::stmt_h_id, and t_proxy_context::stmt_list.

Referenced by fn_proxy_client_prepare(), and proxy_context_add_stmt().

Here is the caller graph for this function:

void proxy_context_set_error_with_msg ( T_PROXY_CONTEXT ctx_p,
int  error_ind,
int  error_code,
const char *  error_msg 
)

Definition at line 297 of file shard_proxy_handler.c.

References t_proxy_context::error_msg, and proxy_context_set_error().

Referenced by proxy_check_authorization(), proxy_client_io_new(), proxy_context_timeout(), and proxy_process_client_register().

Here is the caller graph for this function:

void proxy_context_set_out_tran ( T_PROXY_CONTEXT ctx_p)
int proxy_event_alloc_buffer ( T_PROXY_EVENT event_p,
unsigned int  size 
)
void proxy_event_free ( T_PROXY_EVENT event_p)

Definition at line 1908 of file shard_proxy_handler.c.

References assert, t_proxy_event::buffer, FREE_MEM, and proxy_io_buffer_clear().

Referenced by fn_proxy_cas_check_cas(), fn_proxy_cas_end_tran(), fn_proxy_cas_fetch(), fn_proxy_cas_prepare(), fn_proxy_cas_prepare_and_execute(), fn_proxy_cas_relay_only(), fn_proxy_cas_schema_info(), fn_proxy_client_check_cas(), fn_proxy_client_close_req_handle(), fn_proxy_client_con_close(), fn_proxy_client_cursor(), fn_proxy_client_cursor_close(), fn_proxy_client_end_tran(), fn_proxy_client_fetch(), fn_proxy_client_get_db_parameter(), fn_proxy_client_get_db_version(), fn_proxy_client_not_supported(), fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), fn_proxy_client_schema_info(), fn_proxy_client_set_db_parameter(), fn_proxy_get_shard_info(), proxy_cas_execute_internal(), proxy_client_execute_internal(), proxy_context_clear(), proxy_context_send_error(), proxy_context_timeout(), proxy_event_new_with_error(), proxy_event_new_with_req(), proxy_event_new_with_rsp_ex(), proxy_handler_process_cas_conn_error(), proxy_handler_process_cas_error(), proxy_handler_process_cas_response(), proxy_handler_process_client_conn_error(), proxy_handler_process_client_request(), proxy_handler_process_client_wakeup_by_shard(), proxy_handler_process_client_wakeup_by_statement(), proxy_process_cas_conn_error(), proxy_process_cas_read_error(), proxy_process_cas_register(), proxy_process_cas_response(), proxy_process_cas_write_error(), proxy_process_client_conn_error(), proxy_process_client_read_error(), proxy_process_client_register(), proxy_process_client_request(), proxy_process_client_write_error(), proxy_send_prepared_stmt_to_client(), proxy_send_request_to_cas_with_new_event(), proxy_send_response_to_client_with_new_event(), proxy_socket_io_clear(), proxy_socket_io_new_client(), proxy_socket_io_write(), proxy_socket_io_write_internal(), proxy_socket_set_write_event(), and proxy_wakeup_context_by_shard().

bool proxy_event_io_read_complete ( T_PROXY_EVENT event_p)
T_PROXY_EVENT* proxy_event_new_with_error ( char *  driver_info,
unsigned int  type,
int  from,
int(*)(char *driver_info, char **buffer, int error_ind, int error_code, const char *error_msg, char is_in_tran)  err_func,
int  error_ind,
int  error_code,
const char *  error_msg,
char  is_in_tran 
)

Definition at line 1780 of file shard_proxy_handler.c.

References NULL, proxy_event_free(), proxy_event_new(), and proxy_event_set_buffer().

Referenced by fn_proxy_cas_prepare(), and proxy_context_send_error().

Here is the caller graph for this function:

T_PROXY_EVENT* proxy_event_new_with_req ( char *  driver_info,
unsigned int  type,
int  from,
T_PROXY_EVENT_FUNC  req_func 
)

Definition at line 1723 of file shard_proxy_handler.c.

References NULL, proxy_event_free(), proxy_event_new(), and proxy_event_set_buffer().

Referenced by proxy_event_new_with_rsp(), and proxy_send_request_to_cas_with_new_event().

Here is the caller graph for this function:

T_PROXY_EVENT* proxy_event_new_with_rsp ( char *  driver_info,
unsigned int  type,
int  from,
T_PROXY_EVENT_FUNC  resp_func 
)
T_PROXY_EVENT* proxy_event_new_with_rsp_ex ( char *  driver_info,
unsigned int  type,
int  from,
T_PROXY_EVENT_FUNC_EX  resp_func,
void *  argv 
)

Definition at line 1754 of file shard_proxy_handler.c.

References NULL, proxy_event_free(), proxy_event_new(), and proxy_event_set_buffer().

Referenced by fn_proxy_client_get_db_parameter().

Here is the caller graph for this function:

int proxy_event_realloc_buffer ( T_PROXY_EVENT event_p,
unsigned int  size 
)

Definition at line 1820 of file shard_proxy_handler.c.

References assert, t_proxy_event::buffer, t_io_buffer::data, t_io_buffer::length, and NULL.

Referenced by proxy_socket_io_read_internal().

Here is the caller graph for this function:

void proxy_event_set_buffer ( T_PROXY_EVENT event_p,
char *  data,
unsigned int  size 
)
void proxy_event_set_context ( T_PROXY_EVENT event_p,
int  cid,
unsigned int  uid 
)
void proxy_event_set_shard ( T_PROXY_EVENT event_p,
int  shard_id,
int  cas_id 
)

Definition at line 1877 of file shard_proxy_handler.c.

References assert, t_proxy_event::cas_id, and t_proxy_event::shard_id.

Referenced by proxy_wakeup_context_by_shard().

Here is the caller graph for this function:

void proxy_event_set_type_from ( T_PROXY_EVENT event_p,
unsigned int  type,
int  from_cas 
)

Definition at line 1854 of file shard_proxy_handler.c.

References assert, t_proxy_event::from_cas, and t_proxy_event::type.

Referenced by proxy_process_cas_response(), and proxy_process_client_request().

Here is the caller graph for this function:

void proxy_handler_destroy ( void  )
int proxy_handler_initialize ( void  )
void proxy_handler_process ( void  )
char* proxy_str_context ( T_PROXY_CONTEXT ctx_p)

Definition at line 1079 of file shard_proxy_handler.c.

References t_proxy_context::cas_id, t_proxy_context::cid, t_proxy_context::client_id, t_proxy_context::error_code, t_proxy_context::error_ind, t_proxy_context::error_msg, t_proxy_context::free_context, t_proxy_context::free_on_client_io_write, t_proxy_context::free_on_end_tran, t_proxy_context::func_code, t_proxy_context::is_busy, t_proxy_context::is_cas_in_tran, t_proxy_context::is_client_in_tran, t_proxy_context::is_in_tran, t_proxy_context::is_prepare_for_execute, NULL, proxy_str_event(), t_proxy_context::shard_id, t_proxy_context::stmt_h_id, t_proxy_context::stmt_hint_type, t_proxy_context::uid, t_proxy_context::wait_timeout, and t_proxy_context::waiting_event.

Referenced by fn_proxy_cas_check_cas(), fn_proxy_cas_end_tran(), fn_proxy_cas_fetch(), fn_proxy_cas_prepare(), fn_proxy_cas_prepare_and_execute(), fn_proxy_cas_relay_only(), fn_proxy_cas_schema_info(), fn_proxy_client_check_cas(), fn_proxy_client_close_req_handle(), fn_proxy_client_cursor(), fn_proxy_client_cursor_close(), fn_proxy_client_end_tran(), fn_proxy_client_get_db_parameter(), fn_proxy_client_get_db_version(), fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), fn_proxy_client_schema_info(), fn_proxy_client_set_db_parameter(), proxy_cas_execute_internal(), proxy_client_execute_internal(), proxy_context_add_stmt(), proxy_context_free_client(), proxy_context_free_stmt(), proxy_context_new(), proxy_context_send_error(), proxy_context_timeout(), proxy_handler_process_cas_conn_error(), proxy_handler_process_cas_response(), proxy_handler_process_client_request(), proxy_process_cas_conn_error(), proxy_process_cas_response(), proxy_process_client_conn_error(), proxy_process_client_register(), proxy_process_client_request(), proxy_send_prepared_stmt_to_client(), proxy_send_request_to_cas_with_new_event(), and proxy_send_response_to_client_with_new_event().

void proxy_timer_process ( void  )

Definition at line 1935 of file shard_proxy_handler.c.

References NULL, proxy_available_cas_wait_timer(), PROXY_MAX_IGNORE_TIMER_CHECK, PROXY_TIMER_CHECK_INTERVAL, and shard_statement_wait_timer().

Referenced by main().

Here is the caller graph for this function:

int proxy_waiter_comp_fn ( const void *  arg1,
const void *  arg2 
)

Definition at line 245 of file shard_proxy_handler.c.

References t_wait_context::expire_time.

Referenced by fn_proxy_client_prepare(), and proxy_client_add_waiter_by_shard().

Here is the caller graph for this function:

void proxy_waiter_free ( T_WAIT_CONTEXT waiter)

Definition at line 191 of file shard_proxy_handler.c.

References assert, and FREE_MEM.

Referenced by fn_proxy_client_prepare(), and proxy_waiter_timeout().

Here is the caller graph for this function:

T_WAIT_CONTEXT* proxy_waiter_new ( int  ctx_cid,
unsigned int  ctx_uid,
int  timeout 
)

Definition at line 169 of file shard_proxy_handler.c.

References t_wait_context::ctx_cid, t_wait_context::ctx_uid, t_wait_context::expire_time, and NULL.

Referenced by fn_proxy_client_prepare(), and proxy_client_add_waiter_by_shard().

Here is the caller graph for this function:

void proxy_waiter_timeout ( T_SHARD_QUEUE waitq,
INT64 *  counter,
int  now 
)
char* shard_str_sqls ( char *  sql)

Definition at line 1964 of file shard_proxy_handler.c.

References NULL, and strlen.

Referenced by fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), and shard_str_stmt().

Here is the caller graph for this function: