All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Functions
Info Operations

Description

The Info API provides the ability to query an Aerospike cluster for information.

The following API are provided:

+ Collaboration diagram for Info Operations:

Typedefs

typedef bool(* aerospike_info_foreach_callback )(const as_error *err, const as_node *node, const char *req, char *res, void *udata)
 

Functions

as_status aerospike_info_any (aerospike *as, as_error *err, const as_policy_info *policy, const char *req, char **res)
 
as_status aerospike_info_foreach (aerospike *as, as_error *err, const as_policy_info *policy, const char *req, aerospike_info_foreach_callback callback, void *udata)
 
as_status aerospike_info_host (aerospike *as, as_error *err, const as_policy_info *policy, const char *hostname, uint16_t port, const char *req, char **res)
 
as_status aerospike_info_node (aerospike *as, as_error *err, const as_policy_info *policy, as_node *node, const char *req, char **res)
 
as_status aerospike_info_socket_address (aerospike *as, as_error *err, const as_policy_info *policy, struct sockaddr_in *sa_in, const char *req, char **res)
 

Typedef Documentation

typedef bool(* aerospike_info_foreach_callback)(const as_error *err, const as_node *node, const char *req, char *res, void *udata)

Callback for aerospike_info_foreach()

Parameters
errThe status and possible error information for the info request.
nodeThe node which provided the response.
reqThe initial request.
resThe response to the info request.
udataThe udata provided to the aerospike_info_foreach()
Returns
TRUE to continue to the next info response. FALSE to stop processing.

Definition at line 60 of file aerospike_info.h.

Function Documentation

as_status aerospike_info_any ( aerospike as,
as_error err,
const as_policy_info policy,
const char *  req,
char **  res 
)

Send an info request to a node in the cluster. If node request fails, send request to the next node in the cluster. Repeat until the node request succeeds. The response must be freed by the caller on success.

char* res = NULL;
if ( aerospike_info_any(&as, &err, NULL, "info", &res) != AEROSPIKE_OK ) {
// handle error
}
else {
// handle response
free(res);
res = NULL;
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
reqThe info request to send.
resThe response from the node. The response will be a NULL terminated string, allocated by the function, and must be freed by the caller.
Returns
AEROSPIKE_OK on success. Otherwise an error.
as_status aerospike_info_foreach ( aerospike as,
as_error err,
const as_policy_info policy,
const char *  req,
aerospike_info_foreach_callback  callback,
void *  udata 
)

Send an info request to the entire cluster.

if ( aerospike_info_foreach(&as, &err, NULL, "info", callback, NULL) != AEROSPIKE_OK ) {
// handle error
}

The callback takes a response string. The caller should not free this string.

bool callback(const as_error* err, const as_node * node, const char* req, char* res, void* udata) {
// handle response
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
reqThe info request to send.
callbackThe function to call when a response is received.
udataUser-data to send to the callback.
Returns
AEROSPIKE_OK on success. Otherwise an error.
as_status aerospike_info_host ( aerospike as,
as_error err,
const as_policy_info policy,
const char *  hostname,
uint16_t  port,
const char *  req,
char **  res 
)

Send an info request to a specific host. The response must be freed by the caller on success.

char* res = NULL;
if ( aerospike_info_host(&as, &err, NULL, "127.0.0.1", 3000, "info", &res) != AEROSPIKE_OK ) {
// handle error
}
else {
// handle response
free(res);
res = NULL;
}

If TLS is enabled, this function will only work if the hostname is also the TLS certificate name.

Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
hostnameThe IP address or hostname to send the request to.
portThe port to send the request to.
reqThe info request to send.
resThe response from the node. The response will be a NULL terminated string, allocated by the function, and must be freed by the caller.
Returns
AEROSPIKE_OK on success. Otherwise an error.
as_status aerospike_info_node ( aerospike as,
as_error err,
const as_policy_info policy,
as_node node,
const char *  req,
char **  res 
)

Send an info request to a specific server node. The response must be freed by the caller on success.

char* res = NULL;
if ( aerospike_info_host(&as, &err, NULL, node, "info", &res) != AEROSPIKE_OK ) {
// handle error
}
else {
// handle response
free(res);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
nodeThe server node to send the request to.
reqThe info request to send.
resThe response from the node. The response will be a NULL terminated string, allocated by the function, and must be freed by the caller.
Returns
AEROSPIKE_OK on success. Otherwise an error.
as_status aerospike_info_socket_address ( aerospike as,
as_error err,
const as_policy_info policy,
struct sockaddr_in *  sa_in,
const char *  req,
char **  res 
)

Send an info request to a specific socket address. The response must be freed by the caller on success. This function does not support TLS connections nor IPv6.

char* res = NULL;
if ( aerospike_info_socket_address(&as, &err, NULL, &sa_in, "info", &res) != AEROSPIKE_OK ) {
// handle error
}
else {
// handle response
free(res);
res = NULL;
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
sa_inThe IP address and port to send the request to.
reqThe info request to send.
resThe response from the node. The response will be a NULL terminated string, allocated by the function, and must be freed by the caller.
Returns
AEROSPIKE_OK on success. Otherwise an error.