-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[KIP-482]: Update Describe Configs to v4 #5200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7855,6 +7855,48 @@ rd_kafka_ConfigEntry_is_sensitive(const rd_kafka_ConfigEntry_t *entry); | |
RD_EXPORT int | ||
rd_kafka_ConfigEntry_is_synonym(const rd_kafka_ConfigEntry_t *entry); | ||
|
||
/** | ||
* @enum rd_kafka_ConfigType_t | ||
* @brief Apache Kafka config types. | ||
*/ | ||
typedef enum rd_kafka_ConfigType_t { | ||
RD_KAFKA_CONFIG_UNKNOWN = 0, | ||
RD_KAFKA_CONFIG_BOOLEAN = 1, | ||
RD_KAFKA_CONFIG_STRING = 2, | ||
RD_KAFKA_CONFIG_INT = 3, | ||
RD_KAFKA_CONFIG_SHORT = 4, | ||
RD_KAFKA_CONFIG_LONG = 5, | ||
RD_KAFKA_CONFIG_DOUBLE = 6, | ||
RD_KAFKA_CONFIG_LIST = 7, | ||
RD_KAFKA_CONFIG_CLASS = 8, | ||
RD_KAFKA_CONFIG_PASSWORD = 9, | ||
RD_KAFKA_CONFIG__CNT, | ||
} rd_kafka_ConfigType_t; | ||
|
||
/** | ||
* @returns the config type. | ||
* | ||
* @param entry Entry to get type for. | ||
* | ||
* @remark The lifetime of the returned entry is the same as \p conf . | ||
* @remark Shall only be used on a DescribeConfigs result, | ||
* otherwise returns RD_KAFKA_CONFIG_UNKNOWN. | ||
*/ | ||
RD_EXPORT const rd_kafka_ConfigType_t | ||
rd_kafka_ConfigEntry_type(const rd_kafka_ConfigEntry_t *entry); | ||
|
||
/** | ||
* @returns the config documentation. | ||
* | ||
* @param entry Entry to get documentation for. | ||
* | ||
* @remark The lifetime of the returned entry is the same as \p conf . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parameter reference Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
* @remark Shall only be used on a DescribeConfigs result, | ||
* otherwise returns NULL. | ||
*/ | ||
RD_EXPORT const char * | ||
rd_kafka_ConfigEntry_documentation(const rd_kafka_ConfigEntry_t *entry); | ||
|
||
|
||
/** | ||
* @returns the synonym config entry array. | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2853,6 +2853,16 @@ rd_kafka_ConfigEntry_synonyms(const rd_kafka_ConfigEntry_t *entry, | |||||||||
return (const rd_kafka_ConfigEntry_t **)entry->synonyms.rl_elems; | ||||||||||
} | ||||||||||
|
||||||||||
const rd_kafka_ConfigType_t | ||||||||||
rd_kafka_ConfigEntry_type(const rd_kafka_ConfigEntry_t *entry) { | ||||||||||
return entry->type; | ||||||||||
} | ||||||||||
|
||||||||||
const char * | ||||||||||
rd_kafka_ConfigEntry_documentation(const rd_kafka_ConfigEntry_t *entry) { | ||||||||||
return entry->documentation; | ||||||||||
} | ||||||||||
|
||||||||||
|
||||||||||
/**@}*/ | ||||||||||
|
||||||||||
|
@@ -3662,12 +3672,15 @@ rd_kafka_DescribeConfigsResponse_parse(rd_kafka_op_t *rko_req, | |||||||||
int32_t Throttle_Time; | ||||||||||
rd_kafka_ConfigResource_t *config = NULL; | ||||||||||
rd_kafka_ConfigEntry_t *entry = NULL; | ||||||||||
int16_t api_version; | ||||||||||
|
||||||||||
api_version = rd_kafka_buf_ApiVersion(reply); | ||||||||||
|
||||||||||
Comment on lines
+3675
to
3678
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The variable
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
rd_kafka_buf_read_i32(reply, &Throttle_Time); | ||||||||||
rd_kafka_op_throttle_time(rkb, rk->rk_rep, Throttle_Time); | ||||||||||
|
||||||||||
/* #resources */ | ||||||||||
rd_kafka_buf_read_i32(reply, &res_cnt); | ||||||||||
rd_kafka_buf_read_arraycnt(reply, &res_cnt, RD_KAFKAP_CONFIGS_MAX); | ||||||||||
|
||||||||||
if (res_cnt > rd_list_cnt(&rko_req->rko_u.admin_request.args)) | ||||||||||
rd_kafka_buf_parse_fail( | ||||||||||
|
@@ -3728,10 +3741,13 @@ rd_kafka_DescribeConfigsResponse_parse(rd_kafka_op_t *rko_req, | |||||||||
config->errstr = rd_strdup(this_errstr); | ||||||||||
|
||||||||||
/* #config_entries */ | ||||||||||
rd_kafka_buf_read_i32(reply, &entry_cnt); | ||||||||||
rd_kafka_buf_read_arraycnt(reply, &entry_cnt, | ||||||||||
RD_KAFKAP_CONFIGS_MAX); | ||||||||||
|
||||||||||
for (ci = 0; ci < (int)entry_cnt; ci++) { | ||||||||||
rd_kafkap_str_t config_name, config_value; | ||||||||||
rd_kafkap_str_t config_name, config_value, | ||||||||||
documentation; | ||||||||||
int8_t config_type; | ||||||||||
int32_t syn_cnt; | ||||||||||
int si; | ||||||||||
|
||||||||||
|
@@ -3767,9 +3783,10 @@ rd_kafka_DescribeConfigsResponse_parse(rd_kafka_op_t *rko_req, | |||||||||
rd_kafka_buf_read_bool(reply, &entry->a.is_sensitive); | ||||||||||
|
||||||||||
|
||||||||||
if (rd_kafka_buf_ApiVersion(reply) == 1) { | ||||||||||
if (rd_kafka_buf_ApiVersion(reply) >= 1) { | ||||||||||
/* #config_synonyms (ApiVersion 1) */ | ||||||||||
rd_kafka_buf_read_i32(reply, &syn_cnt); | ||||||||||
rd_kafka_buf_read_arraycnt( | ||||||||||
reply, &syn_cnt, RD_KAFKAP_CONFIGS_MAX); | ||||||||||
|
||||||||||
if (syn_cnt > 100000) | ||||||||||
rd_kafka_buf_parse_fail( | ||||||||||
|
@@ -3800,6 +3817,7 @@ rd_kafka_DescribeConfigsResponse_parse(rd_kafka_op_t *rko_req, | |||||||||
rd_kafka_buf_read_str(reply, &syn_name); | ||||||||||
rd_kafka_buf_read_str(reply, &syn_value); | ||||||||||
rd_kafka_buf_read_i8(reply, &syn_source); | ||||||||||
rd_kafka_buf_skip_tags(reply); | ||||||||||
|
||||||||||
syn_entry = rd_kafka_ConfigEntry_new0( | ||||||||||
syn_name.str, RD_KAFKAP_STR_LEN(&syn_name), | ||||||||||
|
@@ -3825,9 +3843,19 @@ rd_kafka_DescribeConfigsResponse_parse(rd_kafka_op_t *rko_req, | |||||||||
rd_list_add(&entry->synonyms, syn_entry); | ||||||||||
} | ||||||||||
|
||||||||||
if (api_version >= 3) { | ||||||||||
rd_kafka_buf_read_i8(reply, &config_type); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assignment to
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
rd_kafka_buf_read_str(reply, &documentation); | ||||||||||
entry->type = config_type; | ||||||||||
entry->documentation = | ||||||||||
RD_KAFKAP_STR_DUP(&documentation); | ||||||||||
} | ||||||||||
rd_kafka_buf_skip_tags(reply); | ||||||||||
|
||||||||||
rd_kafka_ConfigResource_add_ConfigEntry(config, entry); | ||||||||||
entry = NULL; | ||||||||||
} | ||||||||||
rd_kafka_buf_skip_tags(reply); | ||||||||||
|
||||||||||
/* As a convenience to the application we insert result | ||||||||||
* in the same order as they were requested. The broker | ||||||||||
|
@@ -3856,6 +3884,7 @@ rd_kafka_DescribeConfigsResponse_parse(rd_kafka_op_t *rko_req, | |||||||||
config); | ||||||||||
config = NULL; | ||||||||||
} | ||||||||||
rd_kafka_buf_skip_tags(reply); | ||||||||||
|
||||||||||
*rko_resultp = rko_result; | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter reference
\\p conf
is incorrect. It should reference\\p entry
since that's the actual parameter name for this function.Copilot uses AI. Check for mistakes.