Store module interface header file. More...
#include "mcl/mcl_time_series.h"
#include "mcl/mcl_custom_data.h"
#include "mcl/mcl_stream_data.h"
#include "mcl/mcl_data_source_configuration.h"
#include "mcl/mcl_json_util.h"
#include "mcl/mcl_event.h"
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) |
Store module interface header file.
Definition in file mcl_store.h.
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.
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.
[in] | store | Preinitialized mcl_store_t object to destroy. |
store
is NULL. 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().
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.
[in] | streamable | Indicates if the content of this store will be exchanged using chunked Transfer-Encoding or not. |
[out] | store | The newly initialized store. |
store
is NULL. 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().
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.
[in] | store | MCL store which will contain the new mcl_custom_data_t structure created. |
[in] | version | Version of the custom_data. |
[in] | type | Type of the custom_data. |
[in] | routing | Routing information which is optional. NULL can be given to use the default parser. |
[out] | custom_data | Created and initialized mcl_custom_data_t object. |
store
. 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.
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.
[in] | store | MCL store which will contain the new mcl_data_source_configuration_t structure created. |
[in] | version | Version 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_configuration | Created and initialized mcl_data_source_configuration_t object. |
store
. 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.
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.
[in] | store | MCL store which will contain the new mcl_event_t structure created. |
[in] | version | Version of event. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers. |
[in] | type | Type of event. |
[in] | type_version | Version of event type. |
[in] | severity | Severity level declared in E_MCL_EVENT_SEVERITY. |
[in] | timestamp | Timestamp of the event in YYYY-MM-DDThh:mm:ss.sssZ format. Ex:2016-04-26T08:06:25.317Z. |
[out] | event | Created and initialized event data struct. |
store
. 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.
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.
[in] | store | MCL store which will contain the new mcl_file_t structure created. |
[in] | version | Version of file type. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers. |
[in] | file_path | Path of the file to be added to store. |
[in] | file_name | Name of the file. This name will be assigned to the file that is being uploaded. |
[in] | file_type | Type of the file. |
[in] | routing | Routing information which is optional. NULL can be given to use the default parser. |
[out] | file | Created and initialized file data struct. |
store
. 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.
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.
[in] | store | MCL store which will contain the new mcl_stream_data_t structure created. |
[in] | version | Version of the stream_data. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers. |
[in] | type | Type of the stream_data. |
[in] | routing | Routing information which is optional. NULL can be given to use the default parser. |
[in] | stream_data_read_callback | Stream data read callback function. |
[in] | user_context | User context used to sent to the callback function. |
[out] | stream_data | Created and initialized stream_data data struct. |
store
, version
, type
or stream_data
is NULL. store
is not streamable or version format is not correct. store
. 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().
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.
[in] | store | MCL store which will contain the new mcl_time_series_t structure created. |
[in] | version | Version of the time series data. Format must be in the form of MAJOR.MINOR where major and minor are non-negative integers. |
[in] | configuration_id | Configuration ID of the time series data. |
[in] | routing | Routing information which is optional. NULL can be given to use the default parser. |
[out] | time_series | Created and initialized time series data struct. |
store
. 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().