Scott Baker | 2d89798 | 2019-09-24 11:50:08 -0700 | [diff] [blame^] | 1 | package sarama |
| 2 | |
| 3 | type AddOffsetsToTxnRequest struct { |
| 4 | TransactionalID string |
| 5 | ProducerID int64 |
| 6 | ProducerEpoch int16 |
| 7 | GroupID string |
| 8 | } |
| 9 | |
| 10 | func (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 | |
| 26 | func (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 | |
| 42 | func (a *AddOffsetsToTxnRequest) key() int16 { |
| 43 | return 25 |
| 44 | } |
| 45 | |
| 46 | func (a *AddOffsetsToTxnRequest) version() int16 { |
| 47 | return 0 |
| 48 | } |
| 49 | |
| 50 | func (a *AddOffsetsToTxnRequest) requiredVersion() KafkaVersion { |
| 51 | return V0_11_0_0 |
| 52 | } |