Loading...
Searching...
No Matches
as_listener.h
Go to the documentation of this file.
1/*
2 * Copyright 2008-2018 Aerospike, Inc.
3 *
4 * Portions may be licensed to Aerospike, Inc. under one or more contributor
5 * license agreements.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8 * use this file except in compliance with the License. You may obtain a copy of
9 * the License at http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17#pragma once
18
19#include <aerospike/as_error.h>
20#include <aerospike/as_event.h>
21#include <aerospike/as_record.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 * User callback when an asynchronous write completes.
29 *
30 * @param err This error structure is only populated when the command fails. Null on success.
31 * @param udata User data that is forwarded from asynchronous command function.
32 * @param event_loop Event loop that this command was executed on. Use this event loop when running
33 * nested asynchronous commands when single threaded behavior is desired for the
34 * group of commands.
35 */
36typedef void (*as_async_write_listener) (as_error* err, void* udata, as_event_loop* event_loop);
37
38/**
39 * User callback when an asynchronous read completes with a record result.
40 *
41 * @param err This error structure is only populated when the command fails. Null on success.
42 * @param record The return value from the asynchronous command. Null on error.
43 * @param udata User data that is forwarded from asynchronous command function.
44 * @param event_loop Event loop that this command was executed on. Use this event loop when running
45 * nested asynchronous commands when single threaded behavior is desired for the
46 * group of commands.
47 */
48typedef void (*as_async_record_listener) (as_error* err, as_record* record, void* udata, as_event_loop* event_loop);
49
50/**
51 * User callback when asynchronous read completes with an as_val result.
52 *
53 * @param err This error structure is only populated when the command fails. Null on success.
54 * @param val The return value from the asynchronous command. This value will need to be cast
55 * to the structure that corresponds to the asynchronous command. Null on error.
56 * @param udata User data that is forwarded from asynchronous command function.
57 * @param event_loop Event loop that this command was executed on. Use this event loop when running
58 * nested asynchronous commands when single threaded behavior is desired for the
59 * group of commands.
60 */
61typedef void (*as_async_value_listener) (as_error* err, as_val* val, void* udata, as_event_loop* event_loop);
62
63/**
64 * User callback when pipelined command has been sent, i.e., when the connection is ready for sending
65 * the next command.
66 *
67 * @param udata User data that is forwarded from asynchronous command function.
68 * @param event_loop Event loop that this command was executed on. Use this event loop when running
69 * nested asynchronous commands when single threaded behavior is desired for the
70 * group of commands.
71 */
72typedef void (*as_pipe_listener) (void* udata, as_event_loop* event_loop);
73
74/**
75 * User callback when asynchronous info command completes with a string result.
76 *
77 * @param err This error structure is only populated when the command fails. Null on success.
78 * @param response The return string from the asynchronous info command. Null on error.
79 * Do not free when finished. This will be done automatically.
80 * @param udata User data that is forwarded from asynchronous command function.
81 * @param event_loop Event loop that this command was executed on. Use this event loop when running
82 * nested asynchronous commands when single threaded behavior is desired for the
83 * group of commands.
84 */
85typedef void (*as_async_info_listener) (as_error* err, char* response, void* udata, as_event_loop* event_loop);
86
87#ifdef __cplusplus
88} // end extern "C"
89#endif
void(* as_pipe_listener)(void *udata, as_event_loop *event_loop)
Definition as_listener.h:72
void(* as_async_value_listener)(as_error *err, as_val *val, void *udata, as_event_loop *event_loop)
Definition as_listener.h:61
void(* as_async_write_listener)(as_error *err, void *udata, as_event_loop *event_loop)
Definition as_listener.h:36
void(* as_async_record_listener)(as_error *err, as_record *record, void *udata, as_event_loop *event_loop)
Definition as_listener.h:48
void(* as_async_info_listener)(as_error *err, char *response, void *udata, as_event_loop *event_loop)
Definition as_listener.h:85