MCPcopy
hub / github.com/segmentio/kafka-go / closeMessage

Function closeMessage

protocol/prototest/reflect.go:17–35  ·  view source on GitHub ↗
(m protocol.Message)

Source from the content-addressed store, hash-verified

15)
16
17func closeMessage(m protocol.Message) {
18 forEachField(reflect.ValueOf(m), func(v reflect.Value) {
19 if v.Type().Implements(recordReader) {
20 rr := v.Interface().(protocol.RecordReader)
21 for {
22 r, err := rr.ReadRecord()
23 if err != nil {
24 break
25 }
26 if r.Key != nil {
27 r.Key.Close()
28 }
29 if r.Value != nil {
30 r.Value.Close()
31 }
32 }
33 }
34 })
35}
36
37func load(v interface{}) (reset func()) {
38 return loadValue(reflect.ValueOf(v))

Callers 3

BenchmarkRequestFunction · 0.85
TestResponseFunction · 0.85
BenchmarkResponseFunction · 0.85

Calls 3

forEachFieldFunction · 0.85
ReadRecordMethod · 0.65
CloseMethod · 0.45

Tested by 1

TestResponseFunction · 0.68