(segments [][]byte)
| 24 | } |
| 25 | |
| 26 | func (d *SegmentDecoder) PrepareForRead(segments [][]byte) (*tempopb.Trace, error) { |
| 27 | // each slice is a marshalled tempopb.Trace, unmarshal and combine |
| 28 | combiner := trace.NewCombiner(0, false) |
| 29 | for i, s := range segments { |
| 30 | t := &tempopb.Trace{} |
| 31 | err := proto.Unmarshal(s, t) |
| 32 | if err != nil { |
| 33 | return nil, fmt.Errorf("error unmarshaling trace: %w", err) |
| 34 | } |
| 35 | |
| 36 | _, err = combiner.ConsumeWithFinal(t, i == len(segments)-1) |
| 37 | if err != nil { |
| 38 | return nil, fmt.Errorf("error combining trace: %w", err) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | combinedTrace, _ := combiner.Result() |
| 43 | |
| 44 | return combinedTrace, nil |
| 45 | } |
| 46 | |
| 47 | func (d *SegmentDecoder) ToObject(segments [][]byte) ([]byte, error) { |
| 48 | // wrap byte slices in a tempopb.TraceBytes and marshal |
nothing calls this directly
no test coverage detected