@@ -241,6 +241,141 @@ func (t joinGroupRequestGroupProtocolV1) writeTo(wb *writeBuffer) {
241241 wb .writeBytes (t .ProtocolMetadata )
242242}
243243
244+ type joinGroupRequestV1 struct {
245+ // GroupID holds the unique group identifier
246+ GroupID string
247+
248+ // SessionTimeout holds the coordinator considers the consumer dead if it
249+ // receives no heartbeat after this timeout in ms.
250+ SessionTimeout int32
251+
252+ // RebalanceTimeout holds the maximum time that the coordinator will wait
253+ // for each member to rejoin when rebalancing the group in ms
254+ RebalanceTimeout int32
255+
256+ // MemberID assigned by the group coordinator or the zero string if joining
257+ // for the first time.
258+ MemberID string
259+
260+ // ProtocolType holds the unique name for class of protocols implemented by group
261+ ProtocolType string
262+
263+ // GroupProtocols holds the list of protocols that the member supports
264+ GroupProtocols []joinGroupRequestGroupProtocolV1
265+ }
266+
267+ func (t joinGroupRequestV1 ) size () int32 {
268+ return sizeofString (t .GroupID ) +
269+ sizeofInt32 (t .SessionTimeout ) +
270+ sizeofInt32 (t .RebalanceTimeout ) +
271+ sizeofString (t .MemberID ) +
272+ sizeofString (t .ProtocolType ) +
273+ sizeofArray (len (t .GroupProtocols ), func (i int ) int32 { return t .GroupProtocols [i ].size () })
274+ }
275+
276+ func (t joinGroupRequestV1 ) writeTo (wb * writeBuffer ) {
277+ wb .writeString (t .GroupID )
278+ wb .writeInt32 (t .SessionTimeout )
279+ wb .writeInt32 (t .RebalanceTimeout )
280+ wb .writeString (t .MemberID )
281+ wb .writeString (t .ProtocolType )
282+ wb .writeArray (len (t .GroupProtocols ), func (i int ) { t .GroupProtocols [i ].writeTo (wb ) })
283+ }
284+
285+ type joinGroupResponseMemberV1 struct {
286+ // MemberID assigned by the group coordinator
287+ MemberID string
288+ MemberMetadata []byte
289+ }
290+
291+ func (t joinGroupResponseMemberV1 ) size () int32 {
292+ return sizeofString (t .MemberID ) +
293+ sizeofBytes (t .MemberMetadata )
294+ }
295+
296+ func (t joinGroupResponseMemberV1 ) writeTo (wb * writeBuffer ) {
297+ wb .writeString (t .MemberID )
298+ wb .writeBytes (t .MemberMetadata )
299+ }
300+
301+ func (t * joinGroupResponseMemberV1 ) readFrom (r * bufio.Reader , size int ) (remain int , err error ) {
302+ if remain , err = readString (r , size , & t .MemberID ); err != nil {
303+ return
304+ }
305+ if remain , err = readBytes (r , remain , & t .MemberMetadata ); err != nil {
306+ return
307+ }
308+ return
309+ }
310+
311+ type joinGroupResponseV1 struct {
312+ // ErrorCode holds response error code
313+ ErrorCode int16
314+
315+ // GenerationID holds the generation of the group.
316+ GenerationID int32
317+
318+ // GroupProtocol holds the group protocol selected by the coordinator
319+ GroupProtocol string
320+
321+ // LeaderID holds the leader of the group
322+ LeaderID string
323+
324+ // MemberID assigned by the group coordinator
325+ MemberID string
326+ Members []joinGroupResponseMemberV1
327+ }
328+
329+ func (t joinGroupResponseV1 ) size () int32 {
330+ return sizeofInt16 (t .ErrorCode ) +
331+ sizeofInt32 (t .GenerationID ) +
332+ sizeofString (t .GroupProtocol ) +
333+ sizeofString (t .LeaderID ) +
334+ sizeofString (t .MemberID ) +
335+ sizeofArray (len (t .MemberID ), func (i int ) int32 { return t .Members [i ].size () })
336+ }
337+
338+ func (t joinGroupResponseV1 ) writeTo (wb * writeBuffer ) {
339+ wb .writeInt16 (t .ErrorCode )
340+ wb .writeInt32 (t .GenerationID )
341+ wb .writeString (t .GroupProtocol )
342+ wb .writeString (t .LeaderID )
343+ wb .writeString (t .MemberID )
344+ wb .writeArray (len (t .Members ), func (i int ) { t .Members [i ].writeTo (wb ) })
345+ }
346+
347+ func (t * joinGroupResponseV1 ) readFrom (r * bufio.Reader , size int ) (remain int , err error ) {
348+ if remain , err = readInt16 (r , size , & t .ErrorCode ); err != nil {
349+ return
350+ }
351+ if remain , err = readInt32 (r , remain , & t .GenerationID ); err != nil {
352+ return
353+ }
354+ if remain , err = readString (r , remain , & t .GroupProtocol ); err != nil {
355+ return
356+ }
357+ if remain , err = readString (r , remain , & t .LeaderID ); err != nil {
358+ return
359+ }
360+ if remain , err = readString (r , remain , & t .MemberID ); err != nil {
361+ return
362+ }
363+
364+ fn := func (r * bufio.Reader , size int ) (fnRemain int , fnErr error ) {
365+ var item joinGroupResponseMemberV1
366+ if fnRemain , fnErr = (& item ).readFrom (r , size ); fnErr != nil {
367+ return
368+ }
369+ t .Members = append (t .Members , item )
370+ return
371+ }
372+ if remain , err = readArrayWith (r , remain , fn ); err != nil {
373+ return
374+ }
375+
376+ return
377+ }
378+
244379type joinGroupRequestV5 struct {
245380 // GroupID holds the unique group identifier
246381 GroupID string
0 commit comments