(r protocol.RecordReader)
| 118 | } |
| 119 | |
| 120 | func loadRecords(r protocol.RecordReader) []memoryRecord { |
| 121 | records := []memoryRecord{} |
| 122 | |
| 123 | for { |
| 124 | rec, err := r.ReadRecord() |
| 125 | if err != nil { |
| 126 | if errors.Is(err, io.EOF) { |
| 127 | return records |
| 128 | } |
| 129 | panic(err) |
| 130 | } |
| 131 | records = append(records, memoryRecord{ |
| 132 | offset: rec.Offset, |
| 133 | time: rec.Time, |
| 134 | key: readAll(rec.Key), |
| 135 | value: readAll(rec.Value), |
| 136 | headers: rec.Headers, |
| 137 | }) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func readAll(bytes protocol.Bytes) []byte { |
| 142 | if bytes != nil { |
no test coverage detected