mcl_store.h File Reference

Store module interface header file. More...

Include dependency graph for mcl_store.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct mcl_store_t mcl_store_t
 
typedef struct mcl_file_t mcl_file_t
 This struct is used for building the complete message of file. More...
 

Functions

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_initialize (mcl_bool_t streamable, mcl_store_t **store)
 
MCL_EXPORT E_MCL_ERROR_CODE mcl_store_destroy (mcl_store_t **store)
 
MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_time_series (mcl_store_t *store, const char *version, const char *configuration_id, const char *routing, mcl_time_series_t **time_series)
 
MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_event (mcl_store_t *store, const char *version, const char *type, const char *type_version, E_MCL_EVENT_SEVERITY severity, const char *timestamp, mcl_event_t **event)
 
MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_file (mcl_store_t *store, const char *version, const char *file_path, const char *file_name, const char *file_type, const char *routing, mcl_file_t **file)
 
MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_custom_data (mcl_store_t *store, const char *version, const char *type, const char *routing, mcl_custom_data_t **custom_data)
 
MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_stream_data (mcl_store_t *store, const char *version, const char *type, const char *routing, mcl_stream_data_read_callback_t stream_data_read_callback, void *user_context, mcl_stream_data_t **stream_data)
 
MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_data_source_configuration (mcl_store_t *store, const char *version, mcl_data_source_configuration_t **data_source_configuration)
 

Detailed Description

Store module interface header file.


Date
Jul 15, 2016 Store is the container for all types of data to be exchanged using MCL.

Definition in file mcl_store.h.

Typedef Documentation

typedef struct mcl_file_t mcl_file_t

This struct is used for building the complete message of file.

Definition at line 39 of file mcl_store.h.

typedef struct mcl_store_t mcl_store_t

This struct holds references to data to exchange via communication interface.

Definition at line 34 of file mcl_store.h.

Function Documentation

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_destroy ( mcl_store_t **  store)

This function destroys the mcl_store_t object and frees any memory allocated.

Parameters
[in]storePreinitialized mcl_store_t object to destroy.
Returns

Definition at line 312 of file store.c.

References _store_list_destroy_callback(), ASSERT_NOT_NULL, DEBUG_ENTRY, DEBUG_LEAVE, list_destroy_with_content(), MCL_DEBUG, MCL_FREE, MCL_NULL, and MCL_OK.

Referenced by mcl_store_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_initialize ( mcl_bool_t  streamable,
mcl_store_t **  store 
)

This function creates and initializes an object of type mcl_store_t.

Store is used to hold different types of data. These data will be processed later by mcl_communication module to perform exchange operation. A store can be initialized as streamable or non-streamable (streamable). During exchange operation, data of a Non-Streamable store will be sent to MindSphere using a normal HTTP message, while the data of a streamable store will be sent using chunked Transfer-Encoding.

Parameters
[in]streamableIndicates if the content of this store will be exchanged using chunked Transfer-Encoding or not.
[out]storeThe newly initialized store.
Returns

Definition at line 68 of file store.c.

References ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, list_initialize(), MCL_DEBUG, MCL_FAIL, MCL_FALSE, MCL_NEW, MCL_NULL, MCL_OK, MCL_OPERATION_IS_NOT_SUPPORTED, MCL_OUT_OF_MEMORY, and mcl_store_destroy().

Here is the call graph for this function:

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_custom_data ( mcl_store_t store,
const char *  version,
const char *  type,
const char *  routing,
mcl_custom_data_t **  custom_data 
)

This function creates and initializes a new mcl_custom_data_t structure.

Parameters
[in]storeMCL store which will contain the new mcl_custom_data_t structure created.
[in]versionVersion of the custom_data.
[in]typeType of the custom_data.
[in]routingRouting information which is optional. NULL can be given to use the default parser.
[out]custom_dataCreated and initialized mcl_custom_data_t object.
Returns

Definition at line 230 of file store.c.

References _store_add_data(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, custom_data_destroy(), custom_data_initialize(), DEBUG_ENTRY, DEBUG_LEAVE, MCL_OK, PRIORITY_HIGH, and STORE_DATA_CUSTOM.

Here is the call graph for this function:

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_data_source_configuration ( mcl_store_t store,
const char *  version,
mcl_data_source_configuration_t **  data_source_configuration 
)

This function creates and initializes a new mcl_data_source_configuration_t structure.

Parameters
[in]storeMCL store which will contain the new mcl_data_source_configuration_t structure created.
[in]versionVersion of the data_source_configuration. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers.
[out]data_source_configurationCreated and initialized mcl_data_source_configuration_t object.
Returns

Definition at line 286 of file store.c.

References _is_valid_version(), _store_add_data(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, data_source_configuration_destroy(), data_source_configuration_initialize(), DEBUG_ENTRY, DEBUG_LEAVE, MCL_INVALID_PARAMETER, MCL_OK, MCL_TRUE, PRIORITY_HIGH, and STORE_DATA_DATA_SOURCE_CONFIGURATION.

Here is the call graph for this function:

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_event ( mcl_store_t store,
const char *  version,
const char *  type,
const char *  type_version,
E_MCL_EVENT_SEVERITY  severity,
const char *  timestamp,
mcl_event_t **  event 
)

This function creates and initializes a new mcl_event_t structure.

Parameters
[in]storeMCL store which will contain the new mcl_event_t structure created.
[in]versionVersion of event. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers.
[in]typeType of event.
[in]type_versionVersion of event type.
[in]severitySeverity level declared in E_MCL_EVENT_SEVERITY.
[in]timestampTimestamp of the event in YYYY-MM-DDThh:mm:ss.sssZ format. Ex:2016-04-26T08:06:25.317Z.
[out]eventCreated and initialized event data struct.
Returns

Definition at line 125 of file store.c.

References _compare_item_meta_of_event(), _event_severity_values, _store_add_data(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, string_t::buffer, store_data_t::data, DEBUG_ENTRY, DEBUG_LEAVE, event_destroy(), event_initialize(), event_list_add_event(), event_list_destroy(), event_list_initialize(), EVENT_VERSION_END, list_exist(), MCL_EVENT_SEVERITY_END, MCL_EVENT_SEVERITY_ERROR, MCL_FAIL, MCL_INVALID_PARAMETER, MCL_NULL, MCL_OK, MCL_TRUE, event_list_t::meta, META_FIELD_PAYLOAD_TYPE_BUSINESS_EVENT, meta_field_values, PRIORITY_HIGH, STORE_DATA_EVENT_LIST, string_compare_with_cstr(), time_util_validate_timestamp(), item_meta_payload_local_t::type, and item_meta_payload_local_t::version.

Here is the call graph for this function:

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_file ( mcl_store_t store,
const char *  version,
const char *  file_path,
const char *  file_name,
const char *  file_type,
const char *  routing,
mcl_file_t **  file 
)

This function creates and initializes a new mcl_file_t structure.

Parameters
[in]storeMCL store which will contain the new mcl_file_t structure created.
[in]versionVersion of file type. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers.
[in]file_pathPath of the file to be added to store.
[in]file_nameName of the file. This name will be assigned to the file that is being uploaded.
[in]file_typeType of the file.
[in]routingRouting information which is optional. NULL can be given to use the default parser.
[out]fileCreated and initialized file data struct.
Returns

Definition at line 196 of file store.c.

References _is_valid_version(), _store_add_data(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, file_destroy(), file_initialize(), MCL_ERROR, MCL_FAIL, MCL_INVALID_PARAMETER, MCL_OK, MCL_TRUE, PRIORITY_HIGH, and STORE_DATA_FILE.

Here is the call graph for this function:

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_stream_data ( mcl_store_t store,
const char *  version,
const char *  type,
const char *  routing,
mcl_stream_data_read_callback_t  stream_data_read_callback,
void *  user_context,
mcl_stream_data_t **  stream_data 
)

This function creates and initializes a new streamable mcl_stream_data_t structure.

With this data type, user can specify a callback and context to fill the payload of the custom data. The callback will be called while performing the send operation.

Warning
The store must be initialized as 'streamable' to be able to add this type of item.
Parameters
[in]storeMCL store which will contain the new mcl_stream_data_t structure created.
[in]versionVersion of the stream_data. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers.
[in]typeType of the stream_data.
[in]routingRouting information which is optional. NULL can be given to use the default parser.
[in]stream_data_read_callbackStream data read callback function.
[in]user_contextUser context used to sent to the callback function.
[out]stream_dataCreated and initialized stream_data data struct.
Returns

Definition at line 255 of file store.c.

References _is_valid_version(), _store_add_data(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, MCL_INVALID_PARAMETER, MCL_OK, MCL_TRUE, PRIORITY_HIGH, STORE_DATA_STREAM, stream_data_destroy(), and stream_data_initialize().

Here is the call graph for this function:

MCL_EXPORT E_MCL_ERROR_CODE mcl_store_new_time_series ( mcl_store_t store,
const char *  version,
const char *  configuration_id,
const char *  routing,
mcl_time_series_t **  time_series 
)

This function creates and initializes a new mcl_time_series_t structure.

Parameters
[in]storeMCL store which will contain the new mcl_time_series_t structure created.
[in]versionVersion of the time series data. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers.
[in]configuration_idConfiguration ID of the time series data.
[in]routingRouting information which is optional. NULL can be given to use the default parser.
[out]time_seriesCreated and initialized time series data struct.
Returns

Definition at line 98 of file store.c.

References _is_valid_version(), _store_add_data(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, MCL_INVALID_PARAMETER, MCL_OK, MCL_TRUE, PRIORITY_HIGH, STORE_DATA_TIME_SERIES, time_series_destroy(), and time_series_initialize().

Here is the call graph for this function: