| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package ptrace // import "go.opentelemetry.io/collector/pdata/ptrace" |
| 5 |
|
| 6 |
// MarshalSizer is the interface that groups the basic Marshal and Size methods |
| 7 |
type MarshalSizer interface { |
| 8 |
Marshaler |
| 9 |
Sizer |
| 10 |
} |
| 11 |
|
| 12 |
// Marshaler marshals Traces into bytes. |
| 13 |
type Marshaler interface { |
| 14 |
// MarshalTraces the given Traces into bytes. |
| 15 |
// If the error is not nil, the returned bytes slice cannot be used. |
| 16 |
MarshalTraces(td Traces) ([]byte, error) |
| 17 |
} |
| 18 |
|
| 19 |
// Unmarshaler unmarshalls bytes into Traces. |
| 20 |
type Unmarshaler interface { |
| 21 |
// UnmarshalTraces the given bytes into Traces. |
| 22 |
// If the error is not nil, the returned Traces cannot be used. |
| 23 |
UnmarshalTraces(buf []byte) (Traces, error) |
| 24 |
} |
| 25 |
|
| 26 |
// Sizer is an optional interface implemented by the Marshaler, |
| 27 |
// that calculates the size of a marshaled Traces. |
| 28 |
type Sizer interface { |
| 29 |
// TracesSize returns the size in bytes of a marshaled Traces. |
| 30 |
TracesSize(td Traces) int |
| 31 |
} |