Skip to content

Commit

Permalink
fix(proto): return Version field from version() fn
Browse files Browse the repository at this point in the history
Signed-off-by: Dominic Evans <[email protected]>
  • Loading branch information
dnwe committed Aug 1, 2023
1 parent 031df5d commit 776a630
Show file tree
Hide file tree
Showing 31 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion acl_create_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *CreateAclsResponse) key() int16 {
}

func (c *CreateAclsResponse) version() int16 {
return 0
return c.Version
}

func (c *CreateAclsResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion add_offsets_to_txn_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (a *AddOffsetsToTxnRequest) key() int16 {
}

func (a *AddOffsetsToTxnRequest) version() int16 {
return 0
return a.Version
}

func (a *AddOffsetsToTxnRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion add_offsets_to_txn_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (a *AddOffsetsToTxnResponse) key() int16 {
}

func (a *AddOffsetsToTxnResponse) version() int16 {
return 0
return a.Version
}

func (a *AddOffsetsToTxnResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion add_partitions_to_txn_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (a *AddPartitionsToTxnRequest) key() int16 {
}

func (a *AddPartitionsToTxnRequest) version() int16 {
return 0
return a.Version
}

func (a *AddPartitionsToTxnRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion add_partitions_to_txn_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (a *AddPartitionsToTxnResponse) key() int16 {
}

func (a *AddPartitionsToTxnResponse) version() int16 {
return 0
return a.Version
}

func (a *AddPartitionsToTxnResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion alter_client_quotas_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (a *AlterClientQuotasRequest) key() int16 {
}

func (a *AlterClientQuotasRequest) version() int16 {
return 0
return a.Version
}

func (a *AlterClientQuotasRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion alter_client_quotas_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (a *AlterClientQuotasResponse) key() int16 {
}

func (a *AlterClientQuotasResponse) version() int16 {
return 0
return a.Version
}

func (a *AlterClientQuotasResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion alter_configs_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (a *AlterConfigsRequest) key() int16 {
}

func (a *AlterConfigsRequest) version() int16 {
return 0
return a.Version
}

func (a *AlterConfigsRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion alter_configs_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (a *AlterConfigsResponse) key() int16 {
}

func (a *AlterConfigsResponse) version() int16 {
return 0
return a.Version
}

func (a *AlterConfigsResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion consumer_metadata_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (r *ConsumerMetadataRequest) key() int16 {
}

func (r *ConsumerMetadataRequest) version() int16 {
return 0
return r.Version
}

func (r *ConsumerMetadataRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion consumer_metadata_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (r *ConsumerMetadataResponse) key() int16 {
}

func (r *ConsumerMetadataResponse) version() int16 {
return 0
return r.Version
}

func (r *ConsumerMetadataResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion create_partitions_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (r *CreatePartitionsRequest) key() int16 {
}

func (r *CreatePartitionsRequest) version() int16 {
return 0
return r.Version
}

func (r *CreatePartitionsRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion create_partitions_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (r *CreatePartitionsResponse) key() int16 {
}

func (r *CreatePartitionsResponse) version() int16 {
return 0
return r.Version
}

func (r *CreatePartitionsResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion delete_groups_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (r *DeleteGroupsRequest) key() int16 {
}

func (r *DeleteGroupsRequest) version() int16 {
return 0
return r.Version
}

func (r *DeleteGroupsRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion delete_groups_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (r *DeleteGroupsResponse) key() int16 {
}

func (r *DeleteGroupsResponse) version() int16 {
return 0
return r.Version
}

func (r *DeleteGroupsResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion delete_offsets_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (r *DeleteOffsetsRequest) key() int16 {
}

func (r *DeleteOffsetsRequest) version() int16 {
return 0
return r.Version
}

func (r *DeleteOffsetsRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion delete_offsets_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (r *DeleteOffsetsResponse) key() int16 {
}

func (r *DeleteOffsetsResponse) version() int16 {
return 0
return r.Version
}

func (r *DeleteOffsetsResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion delete_records_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (d *DeleteRecordsRequest) key() int16 {
}

func (d *DeleteRecordsRequest) version() int16 {
return 0
return d.Version
}

func (d *DeleteRecordsRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion delete_records_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (d *DeleteRecordsResponse) key() int16 {
}

func (d *DeleteRecordsResponse) version() int16 {
return 0
return d.Version
}

func (d *DeleteRecordsResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion describe_client_quotas_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (d *DescribeClientQuotasRequest) key() int16 {
}

func (d *DescribeClientQuotasRequest) version() int16 {
return 0
return d.Version
}

func (d *DescribeClientQuotasRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion describe_client_quotas_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (d *DescribeClientQuotasResponse) key() int16 {
}

func (d *DescribeClientQuotasResponse) version() int16 {
return 0
return d.Version
}

func (d *DescribeClientQuotasResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion end_txn_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (a *EndTxnRequest) key() int16 {
}

func (a *EndTxnRequest) version() int16 {
return 0
return a.Version
}

func (r *EndTxnRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion end_txn_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (e *EndTxnResponse) key() int16 {
}

func (e *EndTxnResponse) version() int16 {
return 0
return e.Version
}

func (r *EndTxnResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion incremental_alter_configs_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (a *IncrementalAlterConfigsRequest) key() int16 {
}

func (a *IncrementalAlterConfigsRequest) version() int16 {
return 0
return a.Version
}

func (a *IncrementalAlterConfigsRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion incremental_alter_configs_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (a *IncrementalAlterConfigsResponse) key() int16 {
}

func (a *IncrementalAlterConfigsResponse) version() int16 {
return 0
return a.Version
}

func (a *IncrementalAlterConfigsResponse) headerVersion() int16 {
Expand Down
11 changes: 7 additions & 4 deletions leave_group_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ func (r *LeaveGroupRequest) isValidVersion() bool {
}

func (r *LeaveGroupRequest) requiredVersion() KafkaVersion {
switch r.Version {
case 1, 2, 3:
return V2_3_0_0
switch {
case r.Version >= 2:
return V2_0_0_0
case r.Version >= 1:
return V1_0_0_0
default:
return V0_9_0_0
}
return V0_9_0_0
}
2 changes: 1 addition & 1 deletion list_groups_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (r *ListGroupsRequest) key() int16 {
}

func (r *ListGroupsRequest) version() int16 {
return 0
return r.Version
}

func (r *ListGroupsRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion list_groups_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *ListGroupsResponse) key() int16 {
}

func (r *ListGroupsResponse) version() int16 {
return 0
return r.Version
}

func (r *ListGroupsResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion sasl_handshake_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (r *SaslHandshakeResponse) key() int16 {
}

func (r *SaslHandshakeResponse) version() int16 {
return 0
return r.Version
}

func (r *SaslHandshakeResponse) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion txn_offset_commit_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (a *TxnOffsetCommitRequest) key() int16 {
}

func (a *TxnOffsetCommitRequest) version() int16 {
return 0
return a.Version
}

func (a *TxnOffsetCommitRequest) headerVersion() int16 {
Expand Down
2 changes: 1 addition & 1 deletion txn_offset_commit_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (a *TxnOffsetCommitResponse) key() int16 {
}

func (a *TxnOffsetCommitResponse) version() int16 {
return 0
return a.Version
}

func (a *TxnOffsetCommitResponse) headerVersion() int16 {
Expand Down

0 comments on commit 776a630

Please sign in to comment.