Skip to content

Commit 32d627a

Browse files
committed
rename metadata
1 parent 69f6937 commit 32d627a

9 files changed

Lines changed: 36 additions & 36 deletions

include/aws/mqtt/mqtt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct aws_mqtt_iot_metrics {
132132
* Metadata entries, key value pair to set in metrics
133133
*/
134134
size_t metadata_count;
135-
const struct aws_mqtt_metadata_entry *metadatas;
135+
const struct aws_mqtt_metadata_entry *metadata_entries;
136136
};
137137

138138
AWS_EXTERN_C_BEGIN

include/aws/mqtt/private/mqtt_iot_metrics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct aws_mqtt_iot_metrics_storage {
1616

1717
struct aws_byte_cursor library_name;
1818

19-
/* Array of aws_mqtt_metadata_entry for storage_view.metadatas to point to */
19+
/* Array of aws_mqtt_metadata_entry for storage_view.metadata_entries to point to */
2020
struct aws_array_list metadata_entries;
2121

2222
struct aws_byte_buf storage;

source/mqtt_iot_metrics.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ int aws_mqtt_append_sdk_metrics_to_username(
198198
}
199199

200200
/* Build metadata value string and add to params_list if metadata entries exist */
201-
if (metrics->metadatas != NULL && metrics->metadata_count > 0) {
201+
if (metrics->metadata_entries != NULL && metrics->metadata_count > 0) {
202202
struct aws_byte_cursor key_value_delim = aws_byte_cursor_from_c_str("=");
203203
struct aws_byte_cursor entry_delim = aws_byte_cursor_from_c_str(";");
204204
struct aws_byte_cursor open_paren = aws_byte_cursor_from_c_str("(");
@@ -207,7 +207,7 @@ int aws_mqtt_append_sdk_metrics_to_username(
207207
/* Calculate size needed for metadata value: (key1=value1;key2=value2;...) */
208208
size_t metadata_value_size = open_paren.len + close_paren.len;
209209
for (size_t i = 0; i < metrics->metadata_count; ++i) {
210-
const struct aws_mqtt_metadata_entry *entry = &metrics->metadatas[i];
210+
const struct aws_mqtt_metadata_entry *entry = &metrics->metadata_entries[i];
211211
metadata_value_size += entry->key.len + key_value_delim.len + entry->value.len;
212212
if (i < metrics->metadata_count - 1) {
213213
metadata_value_size += entry_delim.len; /* semicolon separator between entries */
@@ -225,7 +225,7 @@ int aws_mqtt_append_sdk_metrics_to_username(
225225
}
226226

227227
for (size_t i = 0; i < metrics->metadata_count; ++i) {
228-
const struct aws_mqtt_metadata_entry *entry = &metrics->metadatas[i];
228+
const struct aws_mqtt_metadata_entry *entry = &metrics->metadata_entries[i];
229229

230230
if (aws_byte_buf_append(&metadata_value_buf, &entry->key)) {
231231
goto cleanup;
@@ -304,9 +304,9 @@ size_t aws_mqtt_iot_metrics_compute_storage_size(const struct aws_mqtt_iot_metri
304304
storage_size += metrics->library_name.len;
305305

306306
/* Add storage for metadata entries */
307-
if (metrics->metadatas != NULL && metrics->metadata_count > 0) {
307+
if (metrics->metadata_entries != NULL && metrics->metadata_count > 0) {
308308
for (size_t i = 0; i < metrics->metadata_count; ++i) {
309-
const struct aws_mqtt_metadata_entry *entry = &metrics->metadatas[i];
309+
const struct aws_mqtt_metadata_entry *entry = &metrics->metadata_entries[i];
310310
storage_size += entry->key.len;
311311
storage_size += entry->value.len;
312312
}
@@ -345,7 +345,7 @@ struct aws_mqtt_iot_metrics_storage *aws_mqtt_iot_metrics_storage_new(
345345
}
346346

347347
/* Copy metadata entries */
348-
if (metrics_options->metadatas != NULL && metrics_options->metadata_count > 0) {
348+
if (metrics_options->metadata_entries != NULL && metrics_options->metadata_count > 0) {
349349
if (aws_array_list_init_dynamic(
350350
&metrics_storage->metadata_entries,
351351
allocator,
@@ -356,8 +356,8 @@ struct aws_mqtt_iot_metrics_storage *aws_mqtt_iot_metrics_storage_new(
356356

357357
for (size_t i = 0; i < metrics_options->metadata_count; ++i) {
358358
struct aws_mqtt_metadata_entry entry;
359-
entry.key = metrics_options->metadatas[i].key;
360-
entry.value = metrics_options->metadatas[i].value;
359+
entry.key = metrics_options->metadata_entries[i].key;
360+
entry.value = metrics_options->metadata_entries[i].value;
361361

362362
/* Copy key into storage buffer and update cursor */
363363
if (entry.key.len > 0) {
@@ -378,7 +378,7 @@ struct aws_mqtt_iot_metrics_storage *aws_mqtt_iot_metrics_storage_new(
378378

379379
/* Set storage_view to point to the metadata entries array */
380380
storage_view->metadata_count = aws_array_list_length(&metrics_storage->metadata_entries);
381-
storage_view->metadatas = metrics_storage->metadata_entries.data;
381+
storage_view->metadata_entries = metrics_storage->metadata_entries.data;
382382
}
383383

384384
return metrics_storage;
@@ -417,12 +417,12 @@ int aws_mqtt_validate_iot_metrics(const struct aws_mqtt_iot_metrics *metrics) {
417417
}
418418

419419
/* Validate metadata entries */
420-
if (metrics->metadatas != NULL && metrics->metadata_count > 0) {
420+
if (metrics->metadata_entries != NULL && metrics->metadata_count > 0) {
421421
for (size_t i = 0; i < metrics->metadata_count; ++i) {
422-
if (aws_mqtt_validate_utf8_text(metrics->metadatas[i].key)) {
422+
if (aws_mqtt_validate_utf8_text(metrics->metadata_entries[i].key)) {
423423
return AWS_OP_ERR;
424424
}
425-
if (aws_mqtt_validate_utf8_text(metrics->metadatas[i].value)) {
425+
if (aws_mqtt_validate_utf8_text(metrics->metadata_entries[i].value)) {
426426
return AWS_OP_ERR;
427427
}
428428
}

tests/shared_utils_tests.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static int s_test_mqtt_append_sdk_metrics_with_metadata(struct aws_allocator *al
388388
struct aws_mqtt_iot_metrics metrics = {
389389
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
390390
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
391-
.metadatas = metadata_entries,
391+
.metadata_entries = metadata_entries,
392392
};
393393

394394
struct aws_byte_buf output_username;
@@ -429,7 +429,7 @@ static int s_test_mqtt_append_sdk_metrics_with_metadata_invalid_utf8(struct aws_
429429
struct aws_mqtt_iot_metrics metrics = {
430430
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
431431
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
432-
.metadatas = metadata_entries,
432+
.metadata_entries = metadata_entries,
433433
};
434434

435435
struct aws_byte_buf output_username;
@@ -465,7 +465,7 @@ static int s_test_mqtt_append_sdk_metrics_with_metadata_invalid_utf8_value(struc
465465
struct aws_mqtt_iot_metrics metrics = {
466466
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
467467
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
468-
.metadatas = metadata_entries,
468+
.metadata_entries = metadata_entries,
469469
};
470470

471471
struct aws_byte_buf output_username;
@@ -504,7 +504,7 @@ static int s_test_mqtt_iot_metrics_storage_with_metadata(struct aws_allocator *a
504504
struct aws_mqtt_iot_metrics metrics = {
505505
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
506506
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
507-
.metadatas = metadata_entries,
507+
.metadata_entries = metadata_entries,
508508
};
509509

510510
struct aws_mqtt_iot_metrics_storage *storage = aws_mqtt_iot_metrics_storage_new(allocator, &metrics);
@@ -513,13 +513,13 @@ static int s_test_mqtt_iot_metrics_storage_with_metadata(struct aws_allocator *a
513513
/* Verify the storage view has the correct values */
514514
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.library_name, "TestSDK/1.0"));
515515
ASSERT_INT_EQUALS(2, storage->storage_view.metadata_count);
516-
ASSERT_NOT_NULL(storage->storage_view.metadatas);
516+
ASSERT_NOT_NULL(storage->storage_view.metadata_entries);
517517

518518
/* Verify metadata entries are correctly stored */
519-
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadatas[0].key, "Key1"));
520-
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadatas[0].value, "Value1"));
521-
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadatas[1].key, "Key2"));
522-
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadatas[1].value, "Value2"));
519+
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadata_entries[0].key, "Key1"));
520+
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadata_entries[0].value, "Value1"));
521+
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadata_entries[1].key, "Key2"));
522+
ASSERT_TRUE(aws_byte_cursor_eq_c_str(&storage->storage_view.metadata_entries[1].value, "Value2"));
523523

524524
aws_mqtt_iot_metrics_storage_destroy(storage);
525525

@@ -534,7 +534,7 @@ static int s_test_mqtt_iot_metrics_storage_empty_metadata(struct aws_allocator *
534534
struct aws_mqtt_iot_metrics metrics = {
535535
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
536536
.metadata_count = 0,
537-
.metadatas = NULL,
537+
.metadata_entries = NULL,
538538
};
539539

540540
struct aws_mqtt_iot_metrics_storage *storage = aws_mqtt_iot_metrics_storage_new(allocator, &metrics);

tests/v3/connection_state_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,7 +4165,7 @@ static int s_create_mqtt_connection_and_set_metrics(
41654165
username,
41664166
metrics->library_name,
41674167
NULL,
4168-
metrics->metadatas,
4168+
metrics->metadata_entries,
41694169
metrics->metadata_count,
41704170
&expected_buf);
41714171
} else if (username != NULL) {
@@ -4200,7 +4200,7 @@ static int s_test_mqtt_connection_set_metrics_valid_fn(struct aws_allocator *all
42004200
struct aws_mqtt_iot_metrics metrics = {
42014201
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
42024202
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
4203-
.metadatas = metadata_entries,
4203+
.metadata_entries = metadata_entries,
42044204
};
42054205

42064206
struct aws_byte_cursor username = aws_byte_cursor_from_c_str("testuser");
@@ -4251,7 +4251,7 @@ static int s_test_mqtt_connection_set_metrics_with_null_username_fn(struct aws_a
42514251
struct aws_mqtt_iot_metrics metrics = {
42524252
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
42534253
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
4254-
.metadatas = metadata_entries,
4254+
.metadata_entries = metadata_entries,
42554255
};
42564256

42574257
ASSERT_SUCCESS(s_create_mqtt_connection_and_set_metrics(allocator, &metrics, NULL, ctx));

tests/v3/mqtt311_testing_utils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void aws_test_mqtt_build_expected_metrics(
593593
const struct aws_byte_cursor *original_username,
594594
const struct aws_byte_cursor sdk,
595595
const struct aws_byte_cursor *platform,
596-
const struct aws_mqtt_metadata_entry *metadatas,
596+
const struct aws_mqtt_metadata_entry *metadata_entries,
597597
size_t metadata_count,
598598
struct aws_byte_buf *expected_buf) {
599599

@@ -609,11 +609,11 @@ void aws_test_mqtt_build_expected_metrics(
609609
aws_byte_buf_append_dynamic(expected_buf, &platform_to_use);
610610

611611
/* Append metadata if present */
612-
if (metadatas != NULL && metadata_count > 0) {
612+
if (metadata_entries != NULL && metadata_count > 0) {
613613
aws_byte_buf_append_dynamic(expected_buf, &METADATA_ATT_STR);
614614

615615
for (size_t i = 0; i < metadata_count; ++i) {
616-
const struct aws_mqtt_metadata_entry *entry = &metadatas[i];
616+
const struct aws_mqtt_metadata_entry *entry = &metadata_entries[i];
617617
aws_byte_buf_append_dynamic(expected_buf, &entry->key);
618618
aws_byte_buf_append_dynamic(expected_buf, &METADATA_KEY_VALUE_DELIM);
619619
aws_byte_buf_append_dynamic(expected_buf, &entry->value);

tests/v3/mqtt311_testing_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void aws_test311_on_connection_termination_fn(void *userdata);
159159
* @param original_username The original username (can be NULL)
160160
* @param sdk The SDK string
161161
* @param platform The platform string (can be NULL to use default)
162-
* @param metadatas Array of metadata entries (can be NULL if metadata_count is 0)
162+
* @param metadata_entries Array of metadata entries (can be NULL if metadata_count is 0)
163163
* @param metadata_count Number of metadata entries (0 for no metadata)
164164
* @param expected_buf Output buffer for the expected metrics string
165165
*/
@@ -168,7 +168,7 @@ void aws_test_mqtt_build_expected_metrics(
168168
const struct aws_byte_cursor *original_username,
169169
const struct aws_byte_cursor sdk,
170170
const struct aws_byte_cursor *platform,
171-
const struct aws_mqtt_metadata_entry *metadatas,
171+
const struct aws_mqtt_metadata_entry *metadata_entries,
172172
size_t metadata_count,
173173
struct aws_byte_buf *expected_buf);
174174

tests/v5/mqtt5_client_tests.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6782,7 +6782,7 @@ static int s_test_mqtt5_client_set_metrics_valid(struct aws_allocator *allocator
67826782
struct aws_mqtt_iot_metrics metrics = {
67836783
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
67846784
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
6785-
.metadatas = metadata_entries,
6785+
.metadata_entries = metadata_entries,
67866786
};
67876787

67886788
struct aws_byte_cursor username = aws_byte_cursor_from_c_str("test_user");
@@ -6808,7 +6808,7 @@ static int s_test_mqtt5_client_set_metrics_with_null_username(struct aws_allocat
68086808
struct aws_mqtt_iot_metrics metrics = {
68096809
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
68106810
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
6811-
.metadatas = metadata_entries,
6811+
.metadata_entries = metadata_entries,
68126812
};
68136813

68146814
return s_mqtt5_client_metrics_in_username_fn(allocator, &metrics, NULL, ctx);

tests/v5/mqtt5_to_mqtt3_adapter_tests.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4442,7 +4442,7 @@ static int s_mqtt5to3_adapter_connection_set_metrics_valid_fn(struct aws_allocat
44424442
struct aws_mqtt_iot_metrics metrics = {
44434443
.library_name = aws_byte_cursor_from_c_str("TestSDK/1.0"),
44444444
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
4445-
.metadatas = metadata_entries,
4445+
.metadata_entries = metadata_entries,
44464446
};
44474447

44484448
ASSERT_SUCCESS(aws_mqtt_client_connection_set_metrics(connection, &metrics));
@@ -4518,7 +4518,7 @@ static int s_mqtt5to3_adapter_connection_set_metrics_invalid_utf8_library_fn(
45184518
struct aws_mqtt_iot_metrics metrics = {
45194519
.library_name = invalid_utf8_library,
45204520
.metadata_count = AWS_ARRAY_SIZE(metadata_entries),
4521-
.metadatas = metadata_entries,
4521+
.metadata_entries = metadata_entries,
45224522
};
45234523

45244524
ASSERT_FAILS(aws_mqtt_client_connection_set_metrics(connection, &metrics));

0 commit comments

Comments
 (0)