blob: 6da166c634b6bc589db907f0cf48ea7ab6262897 [file] [log] [blame]
William Kurkianea869482019-04-09 15:16:11 -04001package sarama
2
3type AddOffsetsToTxnRequest struct {
4 TransactionalID string
5 ProducerID int64
6 ProducerEpoch int16
7 GroupID string
8}
9
10func (a *AddOffsetsToTxnRequest) encode(pe packetEncoder) error {
11 if err := pe.putString(a.TransactionalID); err != nil {
12 return err
13 }
14
15 pe.putInt64(a.ProducerID)
16
17 pe.putInt16(a.ProducerEpoch)
18
19 if err := pe.putString(a.GroupID); err != nil {
20 return err
21 }
22
23 return nil
24}
25
26func (a *AddOffsetsToTxnRequest) decode(pd packetDecoder, version int16) (err error) {
27 if a.TransactionalID, err = pd.getString(); err != nil {
28 return err
29 }
30 if a.ProducerID, err = pd.getInt64(); err != nil {
31 return err
32 }
33 if a.ProducerEpoch, err = pd.getInt16(); err != nil {
34 return err
35 }
36 if a.GroupID, err = pd.getString(); err != nil {
37 return err
38 }
39 return nil
40}
41
42func (a *AddOffsetsToTxnRequest) key() int16 {
43 return 25
44}
45
46func (a *AddOffsetsToTxnRequest) version() int16 {
47 return 0
48}
49
50func (a *AddOffsetsToTxnRequest) requiredVersion() KafkaVersion {
51 return V0_11_0_0
52}