data_lake_json.c File Reference

Data lake json module implementation file. More...

Include dependency graph for data_lake_json.c:

Go to the source code of this file.

Macros

#define GENERATE_URL_BODY_PRE_PATH_LIST_LENGTH   (sizeof(generate_url_body_pre_path_list) - MCL_NULL_CHAR_SIZE)
 
#define GENERATE_URL_BODY_POST_PATH_LIST_LENGTH   (sizeof("]}") - MCL_NULL_CHAR_SIZE)
 
#define GENERATE_URL_BODY_PRE_PATH_OBJECT_LENGTH   (sizeof(generate_url_body_pre_path_object) - MCL_NULL_CHAR_SIZE)
 
#define GENERATE_URL_BODY_POST_PATH_OBJECT_LENGTH   (sizeof(generate_url_body_post_path_object) - MCL_NULL_CHAR_SIZE)
 
#define SUBTENANT_KEY_LENGTH   (sizeof(subtenant_id_key) - MCL_NULL_CHAR_SIZE)
 
#define SUBTENANT_OVERHEAD   (SUBTENANT_KEY_LENGTH + sizeof("\"") - MCL_NULL_CHAR_SIZE)
 
#define DELIMITER_LENGTH   1
 
#define SLASH_LENGTH   1
 
#define SINGLE_CHARACTER_SIZE   1
 

Functions

static mcl_size_t _calculate_total_path_size (data_lake_object_t **object_array, mcl_size_t array_size, mcl_size_t *valid_path_count)
 
static mcl_error_t _find_matching_object (mcl_json_t *object_url_item, data_lake_object_t **object_array, mcl_size_t array_size, const char *object_path, mcl_size_t compare_size)
 
static mcl_error_t _check_signed_urls (data_lake_object_t **object_array, mcl_size_t array_size)
 
static mcl_size_t _data_lake_json_get_body_size_generate_upload_urls (data_lake_object_t **object_array, mcl_size_t array_size, mcl_size_t client_id_length, mcl_size_t subtenant_id_length)
 
mcl_error_t data_lake_json_from_objects (data_lake_object_t **object_array, mcl_size_t array_size, const char *client_id, const char *subtenant_id, char **json)
 
mcl_error_t data_lake_json_match_signed_urls_with_objects (data_lake_object_t **object_array, mcl_size_t array_size, char *json, mcl_size_t json_size, mcl_size_t client_id_length)
 

Variables

static const char generate_url_body_pre_path_list [] = "{\"paths\":["
 
static const char generate_url_body_pre_path_object [] = "{\"path\":\""
 
static const char generate_url_body_post_path_object [] = "\"}"
 
static const char object_urls_key [] = "objectUrls"
 
static const char signed_url_key [] = "signedUrl"
 
static const char object_path_key [] = "path"
 
static const char subtenant_id_key [] = ",\"subtenantId\":\""
 

Detailed Description

Data lake json module implementation file.

Definition in file data_lake_json.c.

Macro Definition Documentation

#define DELIMITER_LENGTH   1
#define GENERATE_URL_BODY_POST_PATH_LIST_LENGTH   (sizeof("]}") - MCL_NULL_CHAR_SIZE)

Definition at line 23 of file data_lake_json.c.

Referenced by _data_lake_json_get_body_size_generate_upload_urls().

#define GENERATE_URL_BODY_POST_PATH_OBJECT_LENGTH   (sizeof(generate_url_body_post_path_object) - MCL_NULL_CHAR_SIZE)
#define GENERATE_URL_BODY_PRE_PATH_LIST_LENGTH   (sizeof(generate_url_body_pre_path_list) - MCL_NULL_CHAR_SIZE)
#define GENERATE_URL_BODY_PRE_PATH_OBJECT_LENGTH   (sizeof(generate_url_body_pre_path_object) - MCL_NULL_CHAR_SIZE)
#define SINGLE_CHARACTER_SIZE   1

Definition at line 30 of file data_lake_json.c.

Referenced by data_lake_json_from_objects().

#define SUBTENANT_KEY_LENGTH   (sizeof(subtenant_id_key) - MCL_NULL_CHAR_SIZE)

Definition at line 26 of file data_lake_json.c.

Referenced by data_lake_json_from_objects().

#define SUBTENANT_OVERHEAD   (SUBTENANT_KEY_LENGTH + sizeof("\"") - MCL_NULL_CHAR_SIZE)

Definition at line 27 of file data_lake_json.c.

Referenced by _data_lake_json_get_body_size_generate_upload_urls().

Function Documentation

static mcl_size_t _calculate_total_path_size ( data_lake_object_t **  object_array,
mcl_size_t  array_size,
mcl_size_t valid_path_count 
)
static

Definition at line 244 of file data_lake_json.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, mcl_string_util_strlen(), and MCL_WARN.

Referenced by _data_lake_json_get_body_size_generate_upload_urls().

Here is the call graph for this function:

Here is the caller graph for this function:

static mcl_error_t _check_signed_urls ( data_lake_object_t **  object_array,
mcl_size_t  array_size 
)
static

Definition at line 310 of file data_lake_json.c.

References MCL_DATA_LAKE_SIGNED_URL_GENERATION_FAIL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, and MCL_OK.

Referenced by data_lake_json_match_signed_urls_with_objects().

Here is the caller graph for this function:

static mcl_size_t _data_lake_json_get_body_size_generate_upload_urls ( data_lake_object_t **  object_array,
mcl_size_t  array_size,
mcl_size_t  client_id_length,
mcl_size_t  subtenant_id_length 
)
static
static mcl_error_t _find_matching_object ( mcl_json_t object_url_item,
data_lake_object_t **  object_array,
mcl_size_t  array_size,
const char *  object_path,
mcl_size_t  compare_size 
)
static

Definition at line 270 of file data_lake_json.c.

References MCL_DEBUG_LEAVE, mcl_json_util_get_object_item(), mcl_json_util_get_string(), MCL_NULL, MCL_OK, mcl_string_util_strncmp(), data_lake_object_t::signed_url, and signed_url_key.

Referenced by data_lake_json_match_signed_urls_with_objects().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_error_t data_lake_json_from_objects ( data_lake_object_t **  object_array,
mcl_size_t  array_size,
const char *  client_id,
const char *  subtenant_id,
char **  json 
)

This function generates a json string from an array of datalake objects.

Parameters
[in]object_arrayArray of data lake objects.
[in]array_sizeSize of array.
[in]client_idClient ID.
[in]subtenant_idSubtenant ID.
[out]jsonJson body for the request which is needed to generate upload urls.
Returns

Definition at line 46 of file data_lake_json.c.

References _data_lake_json_get_body_size_generate_upload_urls(), DELIMITER_LENGTH, generate_url_body_post_path_object, GENERATE_URL_BODY_POST_PATH_OBJECT_LENGTH, generate_url_body_pre_path_list, GENERATE_URL_BODY_PRE_PATH_LIST_LENGTH, generate_url_body_pre_path_object, GENERATE_URL_BODY_PRE_PATH_OBJECT_LENGTH, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FALSE, MCL_INVALID_PARAMETER, MCL_MALLOC, MCL_NULL, MCL_NULL_CHAR, MCL_NULL_CHAR_SIZE, MCL_OK, MCL_OUT_OF_MEMORY, mcl_string_util_memcpy(), mcl_string_util_strlen(), MCL_TRUE, SINGLE_CHARACTER_SIZE, SLASH_LENGTH, subtenant_id_key, and SUBTENANT_KEY_LENGTH.

Referenced by _generate_upload_urls().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_error_t data_lake_json_match_signed_urls_with_objects ( data_lake_object_t **  object_array,
mcl_size_t  array_size,
char *  json,
mcl_size_t  json_size,
mcl_size_t  client_id_length 
)

This function is used to match signed urls with objects.

Parameters
[in]object_arrayArray of data lake objects.
[in]array_sizeSize of array.
[in]jsonJson string to parse, does not need to be NULL terminated.
[in]json_sizeSize of json string.
[in]client_id_lengthLength of Client ID.
Returns

Definition at line 156 of file data_lake_json.c.

References _check_signed_urls(), _find_matching_object(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, MCL_INVALID_PARAMETER, mcl_json_util_destroy(), mcl_json_util_get_array_item(), mcl_json_util_get_array_size(), mcl_json_util_get_object_item(), mcl_json_util_get_string(), mcl_json_util_parse(), MCL_NULL, MCL_NULL_CHAR_SIZE, MCL_OK, mcl_string_util_strlen(), MCL_WARN, object_path_key, object_urls_key, and SLASH_LENGTH.

Referenced by _generate_upload_urls().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const char generate_url_body_post_path_object[] = "\"}"
static

Definition at line 16 of file data_lake_json.c.

Referenced by data_lake_json_from_objects().

const char generate_url_body_pre_path_list[] = "{\"paths\":["
static

Definition at line 14 of file data_lake_json.c.

Referenced by data_lake_json_from_objects().

const char generate_url_body_pre_path_object[] = "{\"path\":\""
static

Definition at line 15 of file data_lake_json.c.

Referenced by data_lake_json_from_objects().

const char object_path_key[] = "path"
static

Definition at line 19 of file data_lake_json.c.

Referenced by data_lake_json_match_signed_urls_with_objects().

const char object_urls_key[] = "objectUrls"
static

Definition at line 17 of file data_lake_json.c.

Referenced by data_lake_json_match_signed_urls_with_objects().

const char signed_url_key[] = "signedUrl"
static

Definition at line 18 of file data_lake_json.c.

Referenced by _find_matching_object().

const char subtenant_id_key[] = ",\"subtenantId\":\""
static

Definition at line 20 of file data_lake_json.c.

Referenced by data_lake_json_from_objects().