(e PacketEncoder)
| 20 | } |
| 21 | |
| 22 | func (r *FetchRequest) Encode(e PacketEncoder) error { |
| 23 | if r.ReplicaID == 0 { |
| 24 | e.PutInt32(-1) // replica ID is -1 for clients |
| 25 | } else { |
| 26 | e.PutInt32(r.ReplicaID) |
| 27 | } |
| 28 | e.PutInt32(r.MaxWaitTime) |
| 29 | e.PutInt32(r.MinBytes) |
| 30 | // e.PutInt32(r.MaxBytes) |
| 31 | e.PutArrayLength(len(r.Topics)) |
| 32 | for _, t := range r.Topics { |
| 33 | e.PutString(t.Topic) |
| 34 | e.PutArrayLength(len(t.Partitions)) |
| 35 | for _, p := range t.Partitions { |
| 36 | e.PutInt32(p.Partition) |
| 37 | e.PutInt64(p.FetchOffset) |
| 38 | e.PutInt32(p.MaxBytes) |
| 39 | } |
| 40 | } |
| 41 | return nil |
| 42 | } |
| 43 | |
| 44 | func (r *FetchRequest) Decode(d PacketDecoder) error { |
| 45 | var err error |
nothing calls this directly
no test coverage detected