| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package pprofile // import "go.opentelemetry.io/collector/pdata/pprofile" |
| 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 pprofile.Profiles into bytes. |
| 13 |
type Marshaler interface { |
| 14 |
// MarshalProfiles the given pprofile.Profiles into bytes. |
| 15 |
// If the error is not nil, the returned bytes slice cannot be used. |
| 16 |
MarshalProfiles(td Profiles) ([]byte, error) |
| 17 |
} |
| 18 |
|
| 19 |
// Unmarshaler unmarshalls bytes into pprofile.Profiles. |
| 20 |
type Unmarshaler interface { |
| 21 |
// UnmarshalProfiles the given bytes into pprofile.Profiles. |
| 22 |
// If the error is not nil, the returned pprofile.Profiles cannot be used. |
| 23 |
UnmarshalProfiles(buf []byte) (Profiles, error) |
| 24 |
} |
| 25 |
|
| 26 |
// Sizer is an optional interface implemented by the Marshaler, |
| 27 |
// that calculates the size of a marshaled Profiles. |
| 28 |
type Sizer interface { |
| 29 |
// ProfilesSize returns the size in bytes of a marshaled Profiles. |
| 30 |
ProfilesSize(td Profiles) int |
| 31 |
} |