Skip to content

Commit a4eafb4

Browse files
committed
chore(proto): doc CreateTopics/JoinGroup fields
Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
1 parent 503ade3 commit a4eafb4

4 files changed

+72
-24
lines changed

create_topics_request.go

+17-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import (
55
)
66

77
type CreateTopicsRequest struct {
8+
// Version defines the protocol version to use for encode and decode
89
Version int16
9-
10+
// TopicDetails contains the topics to create.
1011
TopicDetails map[string]*TopicDetail
11-
Timeout time.Duration
12+
// Timeout contains how long to wait before timing out the request.
13+
Timeout time.Duration
14+
// ValidateOnly if true, check that the topics can be created as specified,
15+
// but don't create anything.
1216
ValidateOnly bool
1317
}
1418

@@ -103,10 +107,19 @@ func (c *CreateTopicsRequest) requiredVersion() KafkaVersion {
103107
}
104108

105109
type TopicDetail struct {
106-
NumPartitions int32
110+
// NumPartitions contains the number of partitions to create in the topic, or
111+
// -1 if we are either specifying a manual partition assignment or using the
112+
// default partitions.
113+
NumPartitions int32
114+
// ReplicationFactor contains the number of replicas to create for each
115+
// partition in the topic, or -1 if we are either specifying a manual
116+
// partition assignment or using the default replication factor.
107117
ReplicationFactor int16
118+
// ReplicaAssignment contains the manual partition assignment, or the empty
119+
// array if we are using automatic assignment.
108120
ReplicaAssignment map[int32][]int32
109-
ConfigEntries map[string]*string
121+
// ConfigEntries contains the custom topic configurations to set.
122+
ConfigEntries map[string]*string
110123
}
111124

112125
func (t *TopicDetail) encode(pe packetEncoder) error {

create_topics_response.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import (
66
)
77

88
type CreateTopicsResponse struct {
9-
Version int16
9+
// Version defines the protocol version to use for encode and decode
10+
Version int16
11+
// ThrottleTime contains the duration for which the request was throttled due
12+
// to a quota violation, or zero if the request did not violate any quota.
1013
ThrottleTime time.Duration
11-
TopicErrors map[string]*TopicError
14+
// TopicErrors contains a map of any errors for the topics we tried to create.
15+
TopicErrors map[string]*TopicError
1216
}
1317

1418
func (c *CreateTopicsResponse) encode(pe packetEncoder) error {

join_group_request.go

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package sarama
22

33
type GroupProtocol struct {
4-
Name string
4+
// Name contains the protocol name.
5+
Name string
6+
// Metadata contains the protocol metadata.
57
Metadata []byte
68
}
79

@@ -25,14 +27,30 @@ func (p *GroupProtocol) encode(pe packetEncoder) (err error) {
2527
}
2628

2729
type JoinGroupRequest struct {
28-
Version int16
29-
GroupId string
30-
SessionTimeout int32
31-
RebalanceTimeout int32
32-
MemberId string
33-
GroupInstanceId *string
34-
ProtocolType string
35-
GroupProtocols map[string][]byte // deprecated; use OrderedGroupProtocols
30+
// Version defines the protocol version to use for encode and decode
31+
Version int16
32+
// GroupId contains the group identifier.
33+
GroupId string
34+
// SessionTimeout specifies that the coordinator should consider the consumer
35+
// dead if it receives no heartbeat after this timeout in milliseconds.
36+
SessionTimeout int32
37+
// RebalanceTimeout contains the maximum time in milliseconds that the
38+
// coordinator will wait for each member to rejoin when rebalancing the
39+
// group.
40+
RebalanceTimeout int32
41+
// MemberId contains the member id assigned by the group coordinator.
42+
MemberId string
43+
// GroupInstanceId contains the unique identifier of the consumer instance
44+
// provided by end user.
45+
GroupInstanceId *string
46+
// ProtocolType contains the unique name the for class of protocols
47+
// implemented by the group we want to join.
48+
ProtocolType string
49+
// GroupProtocols contains the list of protocols that the member supports.
50+
// deprecated; use OrderedGroupProtocols
51+
GroupProtocols map[string][]byte
52+
// OrderedGroupProtocols contains an ordered list of protocols that the member
53+
// supports.
3654
OrderedGroupProtocols []*GroupProtocol
3755
}
3856

join_group_response.go

+22-9
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,33 @@ package sarama
33
import "time"
44

55
type JoinGroupResponse struct {
6-
Version int16
7-
ThrottleTime int32
8-
Err KError
9-
GenerationId int32
6+
// Version defines the protocol version to use for encode and decode
7+
Version int16
8+
// ThrottleTime contains the duration for which the request was throttled due
9+
// to a quota violation, or zero if the request did not violate any quota.
10+
ThrottleTime int32
11+
// Err contains the error code, or 0 if there was no error.
12+
Err KError
13+
// GenerationId contains the generation ID of the group.
14+
GenerationId int32
15+
// GroupProtocol contains the group protocol selected by the coordinator.
1016
GroupProtocol string
11-
LeaderId string
12-
MemberId string
13-
Members []GroupMember
17+
// LeaderId contains the leader of the group.
18+
LeaderId string
19+
// MemberId contains the member ID assigned by the group coordinator.
20+
MemberId string
21+
// Members contains the per-group-member information.
22+
Members []GroupMember
1423
}
1524

1625
type GroupMember struct {
17-
MemberId string
26+
// MemberId contains the group member ID.
27+
MemberId string
28+
// GroupInstanceId contains the unique identifier of the consumer instance
29+
// provided by end user.
1830
GroupInstanceId *string
19-
Metadata []byte
31+
// Metadata contains the group member metadata.
32+
Metadata []byte
2033
}
2134

2235
func (r *JoinGroupResponse) GetMembers() (map[string]ConsumerGroupMemberMetadata, error) {

0 commit comments

Comments
 (0)