Debian Codegraph @

pdata/plog/encoding.go

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