24#ifndef MYSQL_ASYNC_INCLUDED
25#define MYSQL_ASYNC_INCLUDED
184#define NET_EXTENSION_PTR(N) \
185 ((NET_EXTENSION *)((N)->extension ? (N)->extension : NULL))
187#define NET_ASYNC_DATA(M) \
188 ((NET_EXTENSION_PTR(M)) ? (NET_EXTENSION_PTR(M)->net_async_context) : NULL)
241 const unsigned char *packet,
242 size_t len,
bool *res);
244 NET *
net,
unsigned char command,
const unsigned char *prefix,
245 size_t prefix_len,
const unsigned char *packet,
size_t packet_len,
#define COMP_HEADER_SIZE
compression header extra size
Definition: mysql_com.h:1123
#define NET_HEADER_SIZE
standard header size
Definition: mysql_com.h:1122
unsigned char uchar
Definition: my_inttypes.h:52
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
NET_EXTENSION * net_extension_init()
Definition: net_serv.cc:100
struct MYSQL_ASYNC MYSQL_ASYNC
int mysql_get_socket_descriptor(MYSQL *mysql)
Definition: client.cc:4775
net_read_query_result_status
Different states when reading a query result.
Definition: mysql_async.h:58
@ NET_ASYNC_READ_QUERY_RESULT_FIELD_COUNT
read Ok or read field count sent as part of COM_QUERY
Definition: mysql_async.h:60
@ NET_ASYNC_READ_QUERY_RESULT_IDLE
default state
Definition: mysql_async.h:59
@ NET_ASYNC_READ_QUERY_RESULT_FIELD_INFO
read result of above COM_* command
Definition: mysql_async.h:63
void net_extension_free(NET *)
Definition: net_serv.cc:109
enum net_async_status net_write_command_nonblocking(NET *net, unsigned char command, const unsigned char *prefix, size_t prefix_len, const unsigned char *packet, size_t packet_len, bool *res)
Send a command to the server in asynchronous way.
Definition: net_serv.cc:787
net_async_read_packet_state
Reading a packet is a multi-step process, so we have a state machine.
Definition: mysql_async.h:49
@ NET_ASYNC_PACKET_READ_COMPLETE
state to define if packet is completely read
Definition: mysql_async.h:53
@ NET_ASYNC_PACKET_READ_BODY
read packet contents
Definition: mysql_async.h:52
@ NET_ASYNC_PACKET_READ_IDLE
default packet read state
Definition: mysql_async.h:50
@ NET_ASYNC_PACKET_READ_HEADER
read packet header
Definition: mysql_async.h:51
enum net_async_status my_net_read_nonblocking(NET *net, unsigned long *len_ptr)
net_async_block_state
Async operations are broadly classified into 3 phases: Connection phase, phase of sending data to ser...
Definition: mysql_async.h:81
@ NET_NONBLOCKING_READ
Definition: mysql_async.h:83
@ NET_NONBLOCKING_WRITE
Definition: mysql_async.h:84
@ NET_NONBLOCKING_CONNECT
Definition: mysql_async.h:82
net_send_command_status
Sending a command involves the write as well as reading the status.
Definition: mysql_async.h:68
@ NET_ASYNC_SEND_COMMAND_IDLE
default send command state
Definition: mysql_async.h:69
@ NET_ASYNC_SEND_COMMAND_READ_STATUS
read result of above COM_* command
Definition: mysql_async.h:71
@ NET_ASYNC_SEND_COMMAND_WRITE_COMMAND
send COM_* command
Definition: mysql_async.h:70
struct NET_ASYNC NET_ASYNC
mysql_async_query_state_enum
Query execution in an asynchronous fashion is broadly divided into 3 states which is described in bel...
Definition: mysql_async.h:206
@ QUERY_READING_RESULT
Definition: mysql_async.h:209
@ QUERY_IDLE
Definition: mysql_async.h:207
@ QUERY_SENDING
Definition: mysql_async.h:208
mysql_async_operation_status
Asynchronous operations are broadly classified into 2 categories.
Definition: mysql_async.h:196
@ ASYNC_OP_CONNECT
Definition: mysql_async.h:198
@ ASYNC_OP_UNSET
Definition: mysql_async.h:197
@ ASYNC_OP_QUERY
Definition: mysql_async.h:199
enum net_async_status my_net_write_nonblocking(NET *net, const unsigned char *packet, size_t len, bool *res)
Definition: net_serv.cc:839
net_async_operation
This enum is to represent different asynchronous operations like reading the network,...
Definition: mysql_async.h:41
@ NET_ASYNC_OP_IDLE
default state
Definition: mysql_async.h:42
@ NET_ASYNC_OP_READING
used by my_net_read calls
Definition: mysql_async.h:43
@ NET_ASYNC_OP_WRITING
used by my_net_write calls
Definition: mysql_async.h:44
@ NET_ASYNC_OP_COMPLETE
network read or write is complete
Definition: mysql_async.h:45
Definition: instrumented_condition_variable.h:32
net_async_status
Definition: plugin_auth_common.h:136
Definition: mysql_async.h:212
MYSQL_ROWS ** prev_row_ptr
a pointer to keep track of the previous row of the current result row
Definition: mysql_async.h:216
enum mysql_async_query_state_enum async_query_state
If a query is running, this is its state.
Definition: mysql_async.h:224
unsigned int async_read_metadata_cur_field
Definition: mysql_async.h:229
MYSQL_FIELD * async_read_metadata_fields
Definition: mysql_async.h:227
struct mysql_async_connect * connect_context
Context needed to track the state of a connection being established.
Definition: mysql_async.h:218
MYSQL_ROWS async_read_metadata_data
Definition: mysql_async.h:228
struct MYSQL_RES * async_store_result_result
a pointer to keep track of the result sets
Definition: mysql_async.h:231
unsigned long async_qp_data_length
the query parameters data length
Definition: mysql_async.h:236
size_t async_query_length
Size of the current running async query.
Definition: mysql_async.h:222
MYSQL_DATA * rows_result_buffer
Buffer storing the rows result for cli_read_rows_nonblocking.
Definition: mysql_async.h:214
unsigned long * async_read_metadata_field_len
context needed to support metadata read operation
Definition: mysql_async.h:226
uchar * async_qp_data
the query parameters data
Definition: mysql_async.h:234
enum mysql_async_operation_status async_op_status
Status of the current async op.
Definition: mysql_async.h:220
Definition: mysql_async.h:95
struct io_vec * async_write_vector
Definition: mysql_async.h:125
enum net_async_operation async_operation
Our current operation.
Definition: mysql_async.h:104
size_t async_write_vector_size
Definition: mysql_async.h:126
unsigned char inline_async_write_header[NET_HEADER_SIZE+COMP_HEADER_SIZE+NET_HEADER_SIZE+1]
If the packet length is less than MAX_PACKET_LENGTH then use a static array to hold the meta packet h...
Definition: mysql_async.h:167
enum net_async_block_state async_blocking_state
Blocking state.
Definition: mysql_async.h:102
struct io_vec inline_async_write_vector[3]
Definition: mysql_async.h:168
bool read_rows_is_first_read
Simple state to know if we're reading the first row, and command/query statuses.
Definition: mysql_async.h:111
enum net_send_command_status async_send_command_status
Definition: mysql_async.h:112
size_t async_packet_length
Size of the packet we're currently reading.
Definition: mysql_async.h:118
size_t async_bytes_wanted
How many bytes we want to read.
Definition: mysql_async.h:106
unsigned char * cur_pos
The position in buff we continue reads from when data is next available.
Definition: mysql_async.h:100
unsigned char * async_write_headers
Headers and vector for our async writes; see net_serv.c for detailed description.
Definition: mysql_async.h:124
unsigned char ** compressed_write_buffers
Keep track of compressed buffers.
Definition: mysql_async.h:171
size_t compressed_buffers_size
Size of the compressed buffer.
Definition: mysql_async.h:173
enum net_async_read_packet_state async_packet_read_state
State when waiting on an async read.
Definition: mysql_async.h:116
size_t async_write_vector_current
Definition: mysql_async.h:127
enum net_read_query_result_status async_read_query_result_status
Definition: mysql_async.h:113
Definition: mysql_async.h:176
mysql_compress_context compress_ctx
Definition: mysql_async.h:178
NET_ASYNC * net_async_context
Definition: mysql_async.h:177
Definition: mysql_com.h:914
Represents the packet to be sent on wire asynchronously.
Definition: mysql_async.h:90
size_t iov_len
Number of bytes to transfer.
Definition: mysql_async.h:92
void * iov_base
Starting address.
Definition: mysql_async.h:91
Definition: client_async_authentication.h:164
Compression context information.
Definition: my_compress.h:74
command
Definition: version_token.cc:280