Diffusion C API  6.10.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
recoverable-update-stream.h File Reference

Data Structures

struct  diffusion_recoverable_update_stream_callback_response_s
 Structure representing the response for all DIFFUSION_RECOVERABLE_UPDATE_STREAM_T operations. More...
 
struct  diffusion_recoverable_update_stream_params_s
 Structure provided when calling diffusion_recoverable_update_stream_set or diffusion_recoverable_update_stream_validate. More...
 

Typedefs

typedef struct
DIFFUSION_RECOVERABLE_UPDATE_STREAM_T 
DIFFUSION_RECOVERABLE_UPDATE_STREAM_T
 Opaque diffusion recoverable topic update stream struct.
 
typedef struct
diffusion_recoverable_update_stream_callback_response_s 
DIFFUSION_RECOVERABLE_UPDATE_STREAM_CALLBACK_RESPONSE_T
 Structure representing the response for all DIFFUSION_RECOVERABLE_UPDATE_STREAM_T operations.
 
typedef int(* RECOVERABLE_UPDATE_STREAM_CALLBACK_HANDLER_T )(const SESSION_T *session, const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T *recoverable_update_stream, const DIFFUSION_RECOVERABLE_UPDATE_STREAM_CALLBACK_RESPONSE_T *response, const DIFFUSION_ERROR_T *error, void *context)
 Error handler callback for Recoverable update stream operation.
 
typedef struct
diffusion_recoverable_update_stream_params_s 
DIFFUSION_RECOVERABLE_UPDATE_STREAM_PARAMS_T
 Structure provided when calling diffusion_recoverable_update_stream_set or diffusion_recoverable_update_stream_validate.
 

Functions

bool diffusion_recoverable_update_stream_set (const SESSION_T *session, const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T *recoverable_update_stream, const BUF_T *value, DIFFUSION_RECOVERABLE_UPDATE_STREAM_PARAMS_T params, DIFFUSION_ERROR_T *error)
 Sets the topic to a specified value. More...
 
DIFFUSION_VALUE_Tdiffusion_recoverable_update_stream_get (const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T *recoverable_update_stream, DIFFUSION_ERROR_T *error)
 Return the latest value of the topic set using this update stream. More...
 
bool diffusion_recoverable_update_stream_validate (const SESSION_T *session, const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T *recoverable_update_stream, DIFFUSION_RECOVERABLE_UPDATE_STREAM_PARAMS_T params, DIFFUSION_ERROR_T *error)
 Validates the update stream. More...
 
void diffusion_recoverable_update_stream_free (DIFFUSION_RECOVERABLE_UPDATE_STREAM_T *recoverable_update_stream)
 Free a memory allocated DIFFUSION_RECOVERABLE_UPDATE_STREAM_T More...
 
bool diffusion_recoverable_update_stream_is_in_recovery (const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T *recoverable_update_stream)
 Indicates if the recoverable update stream is currently recovering from a transient exception. More...
 
bool diffusion_recoverable_update_stream_is_error_recoverable (const DIFFUSION_ERROR_T *error)
 Indicates if the error is recoverable by the update stream. More...
 
void diffusion_recoverable_update_stream_recover (const SESSION_T *session, const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T *recoverable_update_stream)
 Begins the procedure to attempt recovery from a transient error. More...
 

Detailed Description

Since
6.10

Function Documentation

void diffusion_recoverable_update_stream_free ( DIFFUSION_RECOVERABLE_UPDATE_STREAM_T recoverable_update_stream)

Free a memory allocated DIFFUSION_RECOVERABLE_UPDATE_STREAM_T

Parameters
recoverable_update_streamThe recoverable update stream to be freed.
Since
6.10
DIFFUSION_VALUE_T* diffusion_recoverable_update_stream_get ( const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T recoverable_update_stream,
DIFFUSION_ERROR_T error 
)

Return the latest value of the topic set using this update stream.

The returned value reflects the last value that has been set, before it is sent to the server.

If the server rejects a set operation, the topic value will not change and this update stream will be invalidated.

diffusion_value_free should be called on the pointer when no longer needed.

Parameters
recoverable_update_streamThe stream to get the latest value from.
errorPopulated when an error occurs.
Returns
The cached value of the topic. NULL, if the update stream is in an invalid state.
Since
6.10
bool diffusion_recoverable_update_stream_is_error_recoverable ( const DIFFUSION_ERROR_T error)

Indicates if the error is recoverable by the update stream.

Parameters
errorThe error.
Returns
True if the error is recoverable, false otherwise.
Since
6.10
bool diffusion_recoverable_update_stream_is_in_recovery ( const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T recoverable_update_stream)

Indicates if the recoverable update stream is currently recovering from a transient exception.

Parameters
recoverable_update_streamThe recoverable update stream.
Returns
True if the recoverable update stream is recovering, false otherwise
Since
6.10
void diffusion_recoverable_update_stream_recover ( const SESSION_T session,
const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T recoverable_update_stream 
)

Begins the procedure to attempt recovery from a transient error.

Parameters
sessionThe session where the recoverable update stream encountered an error.
recoverable_update_streamThe recoverable update stream that will attempt to recover.
Since
6.10
bool diffusion_recoverable_update_stream_set ( const SESSION_T session,
const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T recoverable_update_stream,
const BUF_T *  value,
DIFFUSION_RECOVERABLE_UPDATE_STREAM_PARAMS_T  params,
DIFFUSION_ERROR_T error 
)

Sets the topic to a specified value.

The NULL value can only be passed to the value parameter when updating TOPIC_TYPE_STRING, TOPIC_TYPE_INT64 or TOPIC_TYPE_DOUBLE topics.

When a TOPIC_TYPE_STRING, TOPIC_TYPE_INT64 or TOPIC_TYPE_DOUBLE topic is set to NULL, the topic will be updated to have no value. If a previous value was present subscribers will receive a notification that the new value is NULL. New subscribers will not receive a value notification.

This function may fail with the following errors:

DIFF_ERR_INCOMPATIBLE_EXISTING_TOPIC
The existing topic specification in the server does not match the topic specification provided to the update stream. Subsequent calls may fail with a DIFF_ERR_INVALID_UPDATE_STREAM
DIFF_ERR_NO_SUCH_TOPIC
The topic does not exists in the server and no topic specification was provided to the update stream to create one. Subsequent calls may fail with a DIFF_ERR_INVALID_UPDATE_STREAM
DIFF_ERR_ACCESS_DENIED
Session does not have enough permissions for operation.
DIFF_ERR_NO_SESSION

Session no longer exists.

DIFF_ERR_UPDATE_STREAM_RECOVERY_LIMIT_EXCEEDED
DIFF_ERR_CLUSTER_ROUTING or DIFF_ERR_CLUSTER_REPARTITION has occurred in the cluster where the server resides. The total amount of retries set by the User has been reached and the update stream has stopped attempting to recover.
DIFF_ERR_UNSATISFIED_CONSTRAINT
An update constraint has been provided and it was not satisfied while processing the request on the server.
DIFF_ERR_INVALID_UPDATE_STREAM
The update stream is currently in an invalid state and no further operations are possible.
Parameters
sessionThe session handle. If NULL, this function returns immediately.
recoverable_update_streamThe update stream to enact the update.
valueThe update value.
paramsParameters describing a topic update stream set request and callbacks handlers which may be invoked in response.
errorPopulated when an error occurs
Returns
true is operation is successful, false otherwise. If the operation fails, the error is populated if present.
Since
6.10
bool diffusion_recoverable_update_stream_validate ( const SESSION_T session,
const DIFFUSION_RECOVERABLE_UPDATE_STREAM_T recoverable_update_stream,
DIFFUSION_RECOVERABLE_UPDATE_STREAM_PARAMS_T  params,
DIFFUSION_ERROR_T error 
)

Validates the update stream.

Update streams are validated lazily when the method diffusion_recoverable_update_stream_set is called. This function allows the stream to be validated before a value needs to be set.

If the update stream has not been validated yet, calling this function checks the topic exists, the topic type is correct, the constraint is satisfied and the session has permission to update the topic.

Once it has been validated calling this function checks the topic has not been removed, no other stream has been created for the topic, the value of the topic has not been changed by anything else and the session still has permission to update the topic.

This function may fail with the following errors:

DIFF_ERR_INCOMPATIBLE_EXISTING_TOPIC
The existing topic specification in the server does not match the topic specification provided to the update stream. Subsequent calls may fail with a DIFF_ERR_INVALID_UPDATE_STREAM
DIFF_ERR_NO_SUCH_TOPIC
The topic does not exists in the server and no topic specification was provided to the update stream to create one. Subsequent calls may fail with a DIFF_ERR_INVALID_UPDATE_STREAM
DIFF_ERR_ACCESS_DENIED
Session does not have enough permissions for operation.
DIFF_ERR_NO_SESSION
Session no longer exists.
DIFF_ERR_UPDATE_STREAM_RECOVERY_LIMIT_EXCEEDED
DIFF_ERR_CLUSTER_ROUTING or DIFF_ERR_CLUSTER_REPARTITION has occurred in the cluster where the server resides. The total amount of retries set by the User has been reached and the update stream has stopped attempting to recover.
DIFF_ERR_UNSATISFIED_CONSTRAINT
An update constraint has been provided and it was not satisfied while processing the request on the server.
DIFF_ERR_INVALID_UPDATE_STREAM
The update stream is currently in an invalid state and no further operations are possible.
Parameters
sessionThe session handle. If NULL, this function returns immediately.
recoverable_update_streamThe update stream to be validated.
paramsParameters describing a recoverable update stream validate request and callbacks handlers which may be invoked in response.
errorPopulated when an error occurs.
Returns
True is operation is successful, false otherwise. If the operation fails, the error is populated, if present.
Since
6.10