25 #include <citrusleaf/cf_ll.h>
31 #if defined(AS_USE_LIBEV)
33 #elif defined(AS_USE_LIBUV)
46 #define AS_ASYNC_STATE_UNREGISTERED 0
47 #define AS_ASYNC_STATE_AUTH_WRITE 1
48 #define AS_ASYNC_STATE_AUTH_READ_HEADER 2
49 #define AS_ASYNC_STATE_AUTH_READ_BODY 4
50 #define AS_ASYNC_STATE_WRITE 8
51 #define AS_ASYNC_STATE_READ_HEADER 16
52 #define AS_ASYNC_STATE_READ_BODY 32
54 #define AS_ASYNC_AUTH_RETURN_CODE 1
56 #define AS_EVENT_CONNECTION_COMPLETE 0
57 #define AS_EVENT_CONNECTION_PENDING 1
58 #define AS_EVENT_CONNECTION_ERROR 2
60 #define AS_EVENT_QUEUE_INITIAL_CAPACITY 256
66 #if defined(AS_USE_LIBEV)
69 #elif defined(AS_USE_LIBUV)
97 #if defined(AS_USE_LIBEV)
98 struct ev_timer timer;
99 #elif defined(AS_USE_LIBUV)
137 typedef enum as_connection_status_e {
229 #if defined(AS_USE_LIBEV)
261 #elif defined(AS_USE_LIBUV)
269 if (uv_fileno((uv_handle_t*)&conn->socket, &fd) == 0) {
288 as_uv_timer_closed(uv_handle_t* handle);
295 uv_close((uv_handle_t*)&cmd->timer, as_uv_timer_closed);
358 uint32_t current = as_event_loop_current++;
391 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)
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
as_pipe_listener listener
void as_event_command_free(as_event_command *cmd)
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_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)
int as_socket_validate(int fd)
void as_event_executor_complete(as_event_command *cmd)
static void as_event_decr_connection(as_cluster *cluster, as_queue *queue)
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)
static int as_event_validate_connection(as_event_connection *conn)
#define AS_ASYNC_STATE_AUTH_READ_BODY
static void as_event_stop_watcher(as_event_command *cmd, as_event_connection *conn)
void(* as_pipe_listener)(void *udata, as_event_loop *event_loop)
void as_event_response_error(as_event_command *cmd, as_error *err)
static void as_event_decr_conn(as_event_command *cmd)
void as_event_command_begin(as_event_command *cmd)
bool as_event_send_close_loop(as_event_loop *event_loop)
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)
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)
as_pipe_listener pipe_listener
static void as_event_release_connection(as_cluster *cluster, as_event_connection *conn, as_queue *queue)
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_close_loop(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)
as_connection_status as_event_get_connection(as_event_command *cmd)
static void as_queue_decr_total(as_queue *queue)