All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
as_listener.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2016 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
24 extern "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  */
36 typedef 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. This value will need to be cast
43  * to the structure that corresponds to the asynchronous command. Null on error.
44  * @param udata User data that is forwarded from asynchronous command function.
45  * @param event_loop Event loop that this command was executed on. Use this event loop when running
46  * nested asynchronous commands when single threaded behavior is desired for the
47  * group of commands.
48  */
49 typedef void (*as_async_record_listener) (as_error* err, as_record* record, void* udata, as_event_loop* event_loop);
50 
51 /**
52  * User callback when asynchronous read completes with an as_val result.
53  *
54  * @param err This error structure is only populated when the command fails. Null on success.
55  * @param val The return value from the asynchronous command. This value will need to be cast
56  * to the structure that corresponds to the asynchronous command. Null on error.
57  * @param udata User data that is forwarded from asynchronous command function.
58  * @param event_loop Event loop that this command was executed on. Use this event loop when running
59  * nested asynchronous commands when single threaded behavior is desired for the
60  * group of commands.
61  */
62 typedef void (*as_async_value_listener) (as_error* err, as_val* val, void* udata, as_event_loop* event_loop);
63 
64 /**
65  * User callback when pipelined command has been sent, i.e., when the connection is ready for sending
66  * the next command.
67  *
68  * @param udata User data that is forwarded from asynchronous command function.
69  * @param event_loop Event loop that this command was executed on. Use this event loop when running
70  * nested asynchronous commands when single threaded behavior is desired for the
71  * group of commands.
72  */
73 typedef void (*as_pipe_listener) (void* udata, as_event_loop* event_loop);
74 
75 #ifdef __cplusplus
76 } // end extern "C"
77 #endif