The future result of an operation.

It can represent a result if the operation completed successfully or an error if the operation failed. It can be waited on, polled or a callback can be attached.

Functions

void

cass_future_free

( future )

Frees a future instance. A future can be freed anytime.

Parameters:
Name Type Details
future
CassError

cass_future_set_callback

( future, callback, data )

Sets a callback that is called when a future is set

Parameters:
Name Type Details
in future
in callback
in data
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred

cass_bool_t

cass_future_ready

( future )

Gets the set status of the future.

Parameters:
Name Type Details
in future
Returns:
Type Details
cass_bool_t

true if set

void

cass_future_wait

( future )

Wait for the future to be set with either a result or error.

Important: Do not wait in a future callback. Waiting in a future callback will cause a deadlock.

Parameters:
Name Type Details
in future
cass_bool_t

cass_future_wait_timed

( future, timeout_us )

Wait for the future to be set or timeout.

Parameters:
Name Type Details
in future
in timeout_us

wait time in microseconds

Returns:
Type Details
cass_bool_t

false if returned due to timeout

const CassResult *

cass_future_get_result

( future )

Gets the result of a successful future. If the future is not ready this method will wait for the future to be set. The first successful call consumes the future, all subsequent calls will return NULL.

Parameters:
Name Type Details
in future
Returns:
Type Details
const CassResult *

CassResult instance if successful, otherwise NULL for error. The return instance must be freed using CassResult::cass_result_free.

See Also:
const CassErrorResult *

cass_future_get_error_result

( future )

Gets the error result from a future that failed as a result of a server error. If the future is not ready this method will wait for the future to be set. The first successful call consumes the future, all subsequent calls will return NULL.

Parameters:
Name Type Details
in future
Returns:
Type Details
const CassErrorResult *

CassErrorResult instance if the request failed with a server error, otherwise NULL if the request was sucessful or the failure was not caused by a server error. The return instance must be freed using CassErrorResult::cass_error_result_free.

See Also:
const CassPrepared *

cass_future_get_prepared

( future )

Gets the result of a successful future. If the future is not ready this method will wait for the future to be set. The first successful call consumes the future, all subsequent calls will return NULL.

Parameters:
Name Type Details
in future
Returns:
Type Details
const CassPrepared *

CassPrepared instance if successful, otherwise NULL for error. The return instance must be freed using CassPrepared::cass_prepared_free.

See Also:
CassError

cass_future_error_code

( future )

Gets the error code from future. If the future is not ready this method will wait for the future to be set.

Parameters:
Name Type Details
in future
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

See Also:
void

cass_future_error_message

( future, message, message_length )

Gets the error message from future. If the future is not ready this method will wait for the future to be set.

Parameters:
Name Type Details
in future
out message

Empty string returned if successful, otherwise a message describing the error is returned.

out message_length