MCPcopy
hub / github.com/travisjeffery/jocko / Encode

Method Encode

protocol/fetch_request.go:22–42  ·  view source on GitHub ↗
(e PacketEncoder)

Source from the content-addressed store, hash-verified

20}
21
22func (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
44func (r *FetchRequest) Decode(d PacketDecoder) error {
45 var err error

Callers

nothing calls this directly

Calls 4

PutInt32Method · 0.65
PutArrayLengthMethod · 0.65
PutStringMethod · 0.65
PutInt64Method · 0.65

Tested by

no test coverage detected