MySQL 9.1.0
Source Code Documentation
|
Declarations for asynchronous client communication. More...
#include <mysql.h>
Go to the source code of this file.
Classes | |
struct | io_vec |
Represents the packet to be sent on wire asynchronously. More... | |
struct | mp_state |
Local state for multipacket processing. More... | |
struct | NET_ASYNC |
struct | NET_EXTENSION |
struct | MYSQL_ASYNC |
Macros | |
#define | NET_EXTENSION_PTR(N) ((NET_EXTENSION *)((N)->extension ? (N)->extension : NULL)) |
#define | NET_ASYNC_DATA(M) ((NET_EXTENSION_PTR(M)) ? (NET_EXTENSION_PTR(M)->net_async_context) : NULL) |
Typedefs | |
typedef struct NET_ASYNC | NET_ASYNC |
typedef struct MYSQL_ASYNC | MYSQL_ASYNC |
Enumerations | |
enum | net_async_operation { NET_ASYNC_OP_IDLE = 0 , NET_ASYNC_OP_READING , NET_ASYNC_OP_WRITING , NET_ASYNC_OP_COMPLETE } |
This enum is to represent different asynchronous operations like reading the network, writing to network, idle state, or complete state. More... | |
enum | net_async_read_packet_state { NET_ASYNC_PACKET_READ_IDLE = 0 , NET_ASYNC_PACKET_READ_HEADER , NET_ASYNC_PACKET_READ_BODY , NET_ASYNC_PACKET_READ_COMPLETE } |
Reading a packet is a multi-step process, so we have a state machine. More... | |
enum | net_read_query_result_status { NET_ASYNC_READ_QUERY_RESULT_IDLE = 0 , NET_ASYNC_READ_QUERY_RESULT_FIELD_COUNT , NET_ASYNC_READ_QUERY_RESULT_FIELD_INFO } |
Different states when reading a query result. More... | |
enum | net_send_command_status { NET_ASYNC_SEND_COMMAND_IDLE = 0 , NET_ASYNC_SEND_COMMAND_WRITE_COMMAND , NET_ASYNC_SEND_COMMAND_READ_STATUS } |
Sending a command involves the write as well as reading the status. More... | |
enum | net_async_block_state { NET_NONBLOCKING_CONNECT = 0 , NET_NONBLOCKING_READ , NET_NONBLOCKING_WRITE } |
Async operations are broadly classified into 3 phases: Connection phase, phase of sending data to server (which is writing phase) and reading data from server (which is reading phase). More... | |
enum | mysql_async_operation_status { ASYNC_OP_UNSET = 0 , ASYNC_OP_CONNECT , ASYNC_OP_QUERY } |
Asynchronous operations are broadly classified into 2 categories. More... | |
enum | mysql_async_query_state_enum { QUERY_IDLE = 0 , QUERY_SENDING , QUERY_READING_RESULT } |
Query execution in an asynchronous fashion is broadly divided into 3 states which is described in below enum. More... | |
Functions | |
NET_EXTENSION * | net_extension_init () |
void | net_extension_free (NET *) |
enum net_async_status | my_net_write_nonblocking (NET *net, const unsigned char *packet, size_t len, bool *res) |
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. More... | |
enum net_async_status | my_net_read_nonblocking (NET *net, unsigned long *len_ptr) |
int | mysql_get_socket_descriptor (MYSQL *mysql) |
Declarations for asynchronous client communication.
#define NET_ASYNC_DATA | ( | M | ) | ((NET_EXTENSION_PTR(M)) ? (NET_EXTENSION_PTR(M)->net_async_context) : NULL) |
#define NET_EXTENSION_PTR | ( | N | ) | ((NET_EXTENSION *)((N)->extension ? (N)->extension : NULL)) |
typedef struct MYSQL_ASYNC MYSQL_ASYNC |
enum net_async_operation |
This enum is to represent different asynchronous operations like reading the network, writing to network, idle state, or complete state.
Enumerator | |
---|---|
NET_ASYNC_OP_IDLE | default state |
NET_ASYNC_OP_READING | used by my_net_read calls |
NET_ASYNC_OP_WRITING | used by my_net_write calls |
NET_ASYNC_OP_COMPLETE | network read or write is complete |
Reading a packet is a multi-step process, so we have a state machine.
enum net_async_status my_net_read_nonblocking | ( | NET * | net, |
unsigned long * | len_ptr | ||
) |
enum net_async_status my_net_write_nonblocking | ( | NET * | net, |
const unsigned char * | packet, | ||
size_t | len, | ||
bool * | res | ||
) |
int mysql_get_socket_descriptor | ( | MYSQL * | mysql | ) |
void net_extension_free | ( | NET * | net | ) |
NET_EXTENSION * net_extension_init | ( | ) |
enum net_async_status net_write_command_nonblocking | ( | NET * | net, |
uchar | command, | ||
const uchar * | prefix, | ||
size_t | prefix_len, | ||
const uchar * | packet, | ||
size_t | packet_len, | ||
bool * | res | ||
) |
Send a command to the server in asynchronous way.
This function will first populate all headers in NET::async_write_headers, followed by payload in NET::async_write_vector. Once header and payload is populated in NET, were call net_write_vector_nonblocking to send the packets to server in an asynchronous way.