Skip to content
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

Add support for up to version 4 List Groups API #2541

Merged
merged 1 commit into from
Aug 3, 2023

Conversation

prestona
Copy link
Member

@prestona prestona commented Aug 1, 2023

This adds support for versions 1 through 4 of the ListGroups API.

A compromise for backwards compatibility is the addition of a new GroupsData field to the list groups response, leaving the existing Groups field unchanged:

type ListGroupsResponse struct {
	Version      int16
	ThrottleTime int32
	Err          KError
	Groups       map[string]string    // <- existing field group_id -> protocol_type
	GroupsData   map[string]GroupData // <- new field added by this PR
}

type GroupData struct {
	GroupState string
}

A more faithful, yet incompatible, rendering for this part of the Kafka protocol (see below) would have been to change the type of the existing Groups field to be a map of string (group ID) to a struct with fields for "protocol_type" and "group_state".

ListGroups Response (Version: 4) => throttle_time_ms error_code [groups] TAG_BUFFER 
  throttle_time_ms => INT32
  error_code => INT16
  groups => group_id protocol_type group_state TAG_BUFFER 
    group_id => COMPACT_STRING
    protocol_type => COMPACT_STRING
    group_state => COMPACT_STRING

Ideally, if any further fields are added into the "groups" section of the protocol, they will be added into the GroupsData field of the ListGroupsResponse struct.

Contributes-to: #2408

Signed-off-by: Adrian Preston <PRESTONA@uk.ibm.com>
Copy link
Collaborator

@dnwe dnwe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Changes look good to me, I've rebased on main and just letting the tests run through now

@dnwe dnwe merged commit fb761f2 into IBM:main Aug 3, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants