-
Notifications
You must be signed in to change notification settings - Fork 801
/
Copy pathleavegroup.go
52 lines (42 loc) · 1.23 KB
/
leavegroup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package kafka
import "bufio"
type leaveGroupRequestV1 struct {
// GroupID holds the unique group identifier
GroupID string
// MemberID assigned by the group coordinator or the zero string if joining
// for the first time.
MemberID string
}
func (t leaveGroupRequestV1) size() int32 {
return sizeofString(t.GroupID) +
sizeofString(t.MemberID)
}
func (t leaveGroupRequestV1) writeTo(w *bufio.Writer) {
writeString(w, t.GroupID)
writeString(w, t.MemberID)
}
type leaveGroupResponseV1 struct {
// ThrottleTimeMS holds the duration in milliseconds for which the request
// was throttled due to quota violation (Zero if the request did not violate
// any quota)
ThrottleTimeMS int32
// ErrorCode holds response error code
ErrorCode int16
}
func (t leaveGroupResponseV1) size() int32 {
return sizeofInt32(t.ThrottleTimeMS) +
sizeofInt16(t.ErrorCode)
}
func (t leaveGroupResponseV1) writeTo(w *bufio.Writer) {
writeInt32(w, t.ThrottleTimeMS)
writeInt16(w, t.ErrorCode)
}
func (t *leaveGroupResponseV1) readFrom(r *bufio.Reader, size int) (remain int, err error) {
if remain, err = readInt32(r, size, &t.ThrottleTimeMS); err != nil {
return
}
if remain, err = readInt16(r, remain, &t.ErrorCode); err != nil {
return
}
return
}