Skip to content

Commit

Permalink
Changed uuid to Uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavrth committed Oct 9, 2023
1 parent bdfc5c0 commit 5892f68
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions examples/describe_topics.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ static void print_topic_info(const rd_kafka_TopicDescription_t *topic) {
size_t authorized_operations_cnt;
const rd_kafka_TopicPartitionInfo_t **partitions;
size_t partition_cnt;
rd_kafka_uuid_t *topic_id = rd_kafka_TopicDescription_topic_id(topic);
char *topic_id_str = rd_kafka_uuid_base64str(topic_id);
rd_kafka_Uuid_t *topic_id = rd_kafka_TopicDescription_topic_id(topic);
char *topic_id_str = rd_kafka_Uuid_base64str(topic_id);

if (rd_kafka_error_code(error)) {
printf("Topic: %s (Topic Id: %s) has error[%" PRId32 "]: %s\n",
Expand Down
16 changes: 8 additions & 8 deletions src/rdkafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -5034,9 +5034,9 @@ int rd_kafka_unittest(void) {
*
* @return A newly allocated UUID.
*/
rd_kafka_uuid_t *rd_kafka_uuid_new(int64_t most_significant_bits,
rd_kafka_Uuid_t *rd_kafka_Uuid_new(int64_t most_significant_bits,
int64_t least_significant_bits) {
rd_kafka_uuid_t *uuid = rd_calloc(1, sizeof(rd_kafka_uuid_t));
rd_kafka_Uuid_t *uuid = rd_calloc(1, sizeof(rd_kafka_Uuid_t));
uuid->most_significant_bits = most_significant_bits;
uuid->least_significant_bits = least_significant_bits;
return uuid;
Expand All @@ -5050,8 +5050,8 @@ rd_kafka_uuid_t *rd_kafka_uuid_new(int64_t most_significant_bits,
*
* @remark Dynamically allocated. Deallocate (free) after use.
*/
rd_kafka_uuid_t *rd_kafka_uuid_copy(rd_kafka_uuid_t *uuid) {
rd_kafka_uuid_t *copy_uuid = rd_kafka_uuid_new(
rd_kafka_Uuid_t *rd_kafka_Uuid_copy(rd_kafka_Uuid_t *uuid) {
rd_kafka_Uuid_t *copy_uuid = rd_kafka_Uuid_new(
uuid->most_significant_bits, uuid->least_significant_bits);
if (*uuid->base64str)
memcpy(copy_uuid->base64str, uuid->base64str, 23);
Expand All @@ -5063,11 +5063,11 @@ rd_kafka_uuid_t *rd_kafka_uuid_copy(rd_kafka_uuid_t *uuid) {
*
* @param uuid UUID
*/
void rd_kafka_uuid_destroy(rd_kafka_uuid_t *uuid) {
void rd_kafka_Uuid_destroy(rd_kafka_Uuid_t *uuid) {
rd_free(uuid);
}

char *rd_kafka_uuid_base64str(rd_kafka_uuid_t *uuid) {
char *rd_kafka_Uuid_base64str(rd_kafka_Uuid_t *uuid) {
if (*uuid->base64str)
return uuid->base64str;

Expand All @@ -5093,11 +5093,11 @@ char *rd_kafka_uuid_base64str(rd_kafka_uuid_t *uuid) {
return uuid->base64str;
}

int64_t rd_kafka_uuid_least_significant_bits(rd_kafka_uuid_t *uuid) {
int64_t rd_kafka_Uuid_least_significant_bits(rd_kafka_Uuid_t *uuid) {
return uuid->least_significant_bits;
}


int64_t rd_kafka_uuid_most_significant_bits(rd_kafka_uuid_t *uuid) {
int64_t rd_kafka_Uuid_most_significant_bits(rd_kafka_Uuid_t *uuid) {
return uuid->most_significant_bits;
}
20 changes: 10 additions & 10 deletions src/rdkafka.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ typedef struct rd_kafka_error_s rd_kafka_error_t;
typedef struct rd_kafka_headers_s rd_kafka_headers_t;
typedef struct rd_kafka_group_result_s rd_kafka_group_result_t;
typedef struct rd_kafka_acl_result_s rd_kafka_acl_result_t;
typedef struct rd_kafka_uuid_s rd_kafka_uuid_t;
typedef struct rd_kafka_Uuid_s rd_kafka_Uuid_t;
/* @endcond */


Expand Down Expand Up @@ -1645,7 +1645,7 @@ rd_kafka_message_leader_epoch(const rd_kafka_message_t *rkmessage);
* @return base64 encoded string for the given UUID or NULL in case of some
* issue with the conversion or the conversion is not supported.
*/
RD_EXPORT char *rd_kafka_uuid_base64str(rd_kafka_uuid_t *uuid);
RD_EXPORT char *rd_kafka_Uuid_base64str(rd_kafka_Uuid_t *uuid);

/**
* @brief Gets least significant 64 bits for the given UUID.
Expand All @@ -1654,7 +1654,7 @@ RD_EXPORT char *rd_kafka_uuid_base64str(rd_kafka_uuid_t *uuid);
*
* @return least significant 64 bits for the given UUID.
*/
RD_EXPORT int64_t rd_kafka_uuid_least_significant_bits(rd_kafka_uuid_t *uuid);
RD_EXPORT int64_t rd_kafka_Uuid_least_significant_bits(rd_kafka_Uuid_t *uuid);


/**
Expand All @@ -1664,7 +1664,7 @@ RD_EXPORT int64_t rd_kafka_uuid_least_significant_bits(rd_kafka_uuid_t *uuid);
*
* @return most significant 64 bits for the given UUID.
*/
RD_EXPORT int64_t rd_kafka_uuid_most_significant_bits(rd_kafka_uuid_t *uuid);
RD_EXPORT int64_t rd_kafka_Uuid_most_significant_bits(rd_kafka_Uuid_t *uuid);


/**
Expand All @@ -1674,9 +1674,9 @@ RD_EXPORT int64_t rd_kafka_uuid_most_significant_bits(rd_kafka_uuid_t *uuid);
* @param least_significant_bits least significant 64 bits of the 128 bits UUID.
*
* @return A newly allocated UUID.
* @remark Must be freed after use using rd_kafka_uuid_destroy()
* @remark Must be freed after use using rd_kafka_Uuid_destroy()
*/
RD_EXPORT rd_kafka_uuid_t *rd_kafka_uuid_new(int64_t most_significant_bits,
RD_EXPORT rd_kafka_Uuid_t *rd_kafka_Uuid_new(int64_t most_significant_bits,
int64_t least_significant_bits);

/**
Expand All @@ -1685,16 +1685,16 @@ RD_EXPORT rd_kafka_uuid_t *rd_kafka_uuid_new(int64_t most_significant_bits,
* @param uuid UUID to be copied.
*
* @return A newly allocated copy of the provided UUID.
* @remark Must be freed after use using rd_kafka_uuid_destroy()
* @remark Must be freed after use using rd_kafka_Uuid_destroy()
*/
RD_EXPORT rd_kafka_uuid_t *rd_kafka_uuid_copy(rd_kafka_uuid_t *uuid);
RD_EXPORT rd_kafka_Uuid_t *rd_kafka_Uuid_copy(rd_kafka_Uuid_t *uuid);

/**
* @brief Destroy the provided uuid.
*
* @param uuid UUID
*/
RD_EXPORT void rd_kafka_uuid_destroy(rd_kafka_uuid_t *uuid);
RD_EXPORT void rd_kafka_Uuid_destroy(rd_kafka_Uuid_t *uuid);

/**@}*/

Expand Down Expand Up @@ -8249,7 +8249,7 @@ rd_kafka_TopicDescription_name(const rd_kafka_TopicDescription_t *topicdesc);
* @remark The lifetime of the returned memory is the same
* as the lifetime of the \p topicdesc object.
*/
RD_EXPORT rd_kafka_uuid_t *rd_kafka_TopicDescription_topic_id(
RD_EXPORT rd_kafka_Uuid_t *rd_kafka_TopicDescription_topic_id(
const rd_kafka_TopicDescription_t *topicdesc);

/**
Expand Down
10 changes: 5 additions & 5 deletions src/rdkafka_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -8020,7 +8020,7 @@ rd_kafka_TopicPartitionInfo_destroy(rd_kafka_TopicPartitionInfo_t *pinfo) {
*/
static rd_kafka_TopicDescription_t *rd_kafka_TopicDescription_new(
const char *topic,
rd_kafka_uuid_t *topic_id,
rd_kafka_Uuid_t *topic_id,
const struct rd_kafka_metadata_partition *partitions,
int partition_cnt,
const struct rd_kafka_metadata_broker *brokers_sorted,
Expand All @@ -8034,7 +8034,7 @@ static rd_kafka_TopicDescription_t *rd_kafka_TopicDescription_new(
int i;
topicdesc = rd_calloc(1, sizeof(*topicdesc));
topicdesc->topic = rd_strdup(topic);
topicdesc->topic_id = rd_kafka_uuid_copy(topic_id);
topicdesc->topic_id = rd_kafka_Uuid_copy(topic_id);
topicdesc->partition_cnt = partition_cnt;
topicdesc->is_internal = is_internal;
if (error)
Expand Down Expand Up @@ -8066,7 +8066,7 @@ static rd_kafka_TopicDescription_t *rd_kafka_TopicDescription_new(
*/
static rd_kafka_TopicDescription_t *
rd_kafka_TopicDescription_new_error(const char *topic,
rd_kafka_uuid_t *topic_id,
rd_kafka_Uuid_t *topic_id,
rd_kafka_error_t *error) {
return rd_kafka_TopicDescription_new(topic, topic_id, NULL, 0, NULL,
NULL, 0, NULL, 0, rd_false, error);
Expand All @@ -8079,7 +8079,7 @@ rd_kafka_TopicDescription_destroy(rd_kafka_TopicDescription_t *topicdesc) {
RD_IF_FREE(topicdesc->topic, rd_free);
RD_IF_FREE(topicdesc->error, rd_kafka_error_destroy);
RD_IF_FREE(topicdesc->authorized_operations, rd_free);
RD_IF_FREE(topicdesc->topic_id, rd_kafka_uuid_destroy);
RD_IF_FREE(topicdesc->topic_id, rd_kafka_Uuid_destroy);
for (i = 0; i < topicdesc->partition_cnt; i++)
rd_kafka_TopicPartitionInfo_destroy(topicdesc->partitions[i]);
rd_free(topicdesc->partitions);
Expand Down Expand Up @@ -8146,7 +8146,7 @@ rd_kafka_TopicDescription_error(const rd_kafka_TopicDescription_t *topicdesc) {
return topicdesc->error;
}

rd_kafka_uuid_t *rd_kafka_TopicDescription_topic_id(
rd_kafka_Uuid_t *rd_kafka_TopicDescription_topic_id(
const rd_kafka_TopicDescription_t *topicdesc) {
return topicdesc->topic_id;
}
Expand Down
2 changes: 1 addition & 1 deletion src/rdkafka_admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ struct rd_kafka_TopicPartitionInfo_s {
*/
struct rd_kafka_TopicDescription_s {
char *topic; /**< Topic name */
rd_kafka_uuid_t *topic_id; /**< Topic Id */
rd_kafka_Uuid_t *topic_id; /**< Topic Id */
int partition_cnt; /**< Number of partitions in \p partitions*/
rd_bool_t is_internal; /**< Is the topic is internal to Kafka? */
rd_kafka_TopicPartitionInfo_t **partitions; /**< Partitions */
Expand Down
2 changes: 1 addition & 1 deletion src/rdkafka_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ void rd_kafka_buf_set_maker(rd_kafka_buf_t *rkbuf,
} while (0)

static RD_UNUSED void rd_kafka_buf_write_uuid(rd_kafka_buf_t *rkbuf,
rd_kafka_uuid_t *uuid) {
rd_kafka_Uuid_t *uuid) {
rd_kafka_buf_write_i64(rkbuf, uuid->most_significant_bits);
rd_kafka_buf_write_i64(rkbuf, uuid->least_significant_bits);
}
Expand Down
2 changes: 1 addition & 1 deletion src/rdkafka_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef struct rd_kafka_metadata_topic_internal_s {
* same count as metadata.topics[i].partition_cnt.
* Sorted by Partition Id. */
rd_kafka_metadata_partition_internal_t *partitions;
rd_kafka_uuid_t topic_id;
rd_kafka_Uuid_t topic_id;
int32_t topic_authorized_operations; /**< ACL operations allowed
* for topic, -1 if not
* supported by broker */
Expand Down
6 changes: 3 additions & 3 deletions src/rdkafka_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,16 +572,16 @@ typedef struct rd_kafka_buf_s rd_kafka_buf_t;
/**
* @struct Struct representing UUID protocol primitive type.
*/
typedef struct rd_kafka_uuid_s {
typedef struct rd_kafka_Uuid_s {
int64_t
most_significant_bits; /**< Most significant 64 bits for the UUID */
int64_t least_significant_bits; /**< Least significant 64 bits for the
UUID */
char base64str[23]; /**< base64 encoding for the uuid. By default, it is
lazy loaded. Use function
`rd_kafka_uuid_base64str()` as a getter for this
`rd_kafka_Uuid_base64str()` as a getter for this
field. */
} rd_kafka_uuid_t;
} rd_kafka_Uuid_t;

#define RD_KAFKA_UUID_ZERO \
{ 0, 0, "" }
Expand Down
2 changes: 1 addition & 1 deletion src/rdkafka_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,7 @@ rd_kafka_MetadataRequest0(rd_kafka_broker_t *rkb,
if (topic_cnt > 0) {
char *topic;
int i;
rd_kafka_uuid_t zero_uuid = RD_KAFKA_UUID_ZERO;
rd_kafka_Uuid_t zero_uuid = RD_KAFKA_UUID_ZERO;

/* Maintain a copy of the topics list so we can purge
* hints from the metadata cache on error. */
Expand Down

0 comments on commit 5892f68

Please sign in to comment.