24 #include <citrusleaf/cf_ll.h>
30 #if defined(AS_USE_LIBEV)
32 #elif defined(AS_USE_LIBUV)
45 #define AS_ASYNC_STATE_UNREGISTERED 0
46 #define AS_ASYNC_STATE_AUTH_WRITE 1
47 #define AS_ASYNC_STATE_AUTH_READ_HEADER 2
48 #define AS_ASYNC_STATE_AUTH_READ_BODY 4
49 #define AS_ASYNC_STATE_WRITE 8
50 #define AS_ASYNC_STATE_READ_HEADER 16
51 #define AS_ASYNC_STATE_READ_BODY 32
53 #define AS_ASYNC_AUTH_RETURN_CODE 1
55 #define AS_EVENT_CONNECTION_COMPLETE 0
56 #define AS_EVENT_CONNECTION_PENDING 1
57 #define AS_EVENT_CONNECTION_ERROR 2
59 #define AS_EVENT_QUEUE_INITIAL_CAPACITY 256
65 #if defined(AS_USE_LIBEV)
68 #elif defined(AS_USE_LIBUV)
91 #if defined(AS_USE_LIBEV)
92 struct ev_timer timer;
93 #elif defined(AS_USE_LIBUV)
223 #if defined(AS_USE_LIBEV)
255 #elif defined(AS_USE_LIBUV)
263 if (uv_fileno((uv_handle_t*)&conn->socket, &fd) == 0) {
282 as_uv_timer_closed(uv_handle_t* handle);
289 uv_close((uv_handle_t*)&cmd->timer, as_uv_timer_closed);
352 uint32_t current = as_event_loop_current++;
385 cmd->
auth_len = (uint32_t)proto->sz;
as_event_loop * event_loop
int as_event_create_socket(as_event_command *cmd)
as_event_parse_results_fn parse_results
void as_event_timeout(as_event_command *cmd)
bool as_event_command_parse_success_failure(as_event_command *cmd)
static void as_event_decr_conn_count(as_cluster *cluster, as_node *node, bool pipeline)
uint32_t as_event_loop_size
as_event_executor_complete_fn complete_fn
bool(* as_event_parse_results_fn)(struct as_event_command *cmd)
#define AS_ASYNC_STATE_AUTH_READ_HEADER
static void as_event_set_auth_parse_header(as_event_command *cmd)
void as_proto_swap_from_be(as_proto *m)
static void as_event_set_auth_read_header(as_event_command *cmd)
bool as_socket_validate(int fd, bool pipe)
bool as_event_command_parse_header(as_event_command *cmd)
void as_event_executor_cancel(as_event_executor *executor, int queued_count)
static void as_event_command_release(as_event_command *cmd)
void as_event_node_destroy(as_node *node)
void as_event_socket_error(as_event_command *cmd, as_error *err)
void as_event_executor_complete(as_event_command *cmd)
static bool as_event_validate_connection(as_event_connection *conn, bool pipeline)
bool as_event_send(as_event_command *cmd)
char * as_error_string(as_status status)
struct as_event_command ** commands
bool as_event_create_loop(as_event_loop *event_loop)
as_event_loop * event_loop
as_status as_event_command_execute(as_event_command *cmd, as_error *err)
void(* as_event_executor_complete_fn)(struct as_event_executor *executor, as_error *err)
#define AS_ASYNC_STATE_AUTH_READ_BODY
static void as_event_stop_watcher(as_event_command *cmd, as_event_connection *conn)
void as_event_response_error(as_event_command *cmd, as_error *err)
void as_event_command_begin(as_event_command *cmd)
void as_event_register_external_loop(as_event_loop *event_loop)
#define as_error_set_message(__err, __code, __msg)
uint32_t as_authenticate_set(const char *user, const char *credential, uint8_t *buffer)
bool as_event_close_loop(as_event_loop *event_loop)
static void as_event_command_execute_in_loop(as_event_command *cmd)
uint32_t async_conn_count
as_event_connection * conn
static void as_event_set_auth_write(as_event_command *cmd)
as_event_loop * as_event_loops
static void as_event_stop_timer(as_event_command *cmd)
void as_event_close_connection(as_event_connection *conn)
static void as_event_command_free(as_event_command *cmd)
static void as_node_release(as_node *node)
bool as_event_get_connection(as_event_command *cmd)
uint32_t as_event_loop_current
void(* as_event_executor_destroy_fn)(struct as_event_executor *executor)
bool as_event_command_parse_result(as_event_command *cmd)
struct as_event_command * cmd
static as_event_loop * as_event_assign(as_event_loop *event_loop)
void as_event_error_callback(as_event_command *cmd, as_error *err)
void as_event_connect_error(as_event_command *cmd, as_error *err, int fd)
uint32_t async_conn_count