(pe packetEncoder)
| 88 | } |
| 89 | |
| 90 | func (r *OffsetRequest) encode(pe packetEncoder) error { |
| 91 | if r.isReplicaIDSet { |
| 92 | pe.putInt32(r.replicaID) |
| 93 | } else { |
| 94 | // default replica ID is always -1 for clients |
| 95 | pe.putInt32(-1) |
| 96 | } |
| 97 | |
| 98 | if r.Version >= 2 { |
| 99 | pe.putBool(r.IsolationLevel == ReadCommitted) |
| 100 | } |
| 101 | |
| 102 | err := pe.putArrayLength(len(r.blocks)) |
| 103 | if err != nil { |
| 104 | return err |
| 105 | } |
| 106 | for topic, partitions := range r.blocks { |
| 107 | err = pe.putString(topic) |
| 108 | if err != nil { |
| 109 | return err |
| 110 | } |
| 111 | err = pe.putArrayLength(len(partitions)) |
| 112 | if err != nil { |
| 113 | return err |
| 114 | } |
| 115 | for partition, block := range partitions { |
| 116 | pe.putInt32(partition) |
| 117 | if err = block.encode(pe, r.Version); err != nil { |
| 118 | return err |
| 119 | } |
| 120 | } |
| 121 | pe.putEmptyTaggedFieldArray() |
| 122 | } |
| 123 | |
| 124 | pe.putEmptyTaggedFieldArray() |
| 125 | |
| 126 | return nil |
| 127 | } |
| 128 | |
| 129 | func (r *OffsetRequest) decode(pd packetDecoder, version int16) error { |
| 130 | r.Version = version |
nothing calls this directly
no test coverage detected