Skip to content

Commit 2cdfcc4

Browse files
committed
renamings
1 parent dd2068d commit 2cdfcc4

File tree

10 files changed

+46
-46
lines changed

10 files changed

+46
-46
lines changed

model/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Protocols
2+
3+
This package provides common ways for decoding serialized bytes into protocol-specific in-memory data models (e.g. Zipkin Span). These data models can then be translated to internal pdata representations. Similarly, pdata can be translated from a data model which can then be serialized into bytes.
4+
5+
[serializer](serializer): Common interfaces for serializing/deserializing bytes from/to data models.
6+
7+
[translator](translator): Common interfaces for translating protocol-specific data models from/to pdata.
8+
9+
This package provides higher level APIs that do both encoding of bytes and data model if going directly pdata ⇔ bytes.
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414

1515
package encoding
1616

17-
// MetricsEncoder encodes data model into bytes.
18-
type MetricsEncoder interface {
19-
EncodeMetrics(model interface{}) ([]byte, error)
17+
// MetricsDeserializer decodes bytes into data model.
18+
type MetricsDeserializer interface {
19+
DeserializeMetrics(bytes []byte) (interface{}, error)
2020
}
2121

22-
// TracesEncoder encodes data model into bytes.
23-
type TracesEncoder interface {
24-
EncodeTraces(model interface{}) ([]byte, error)
22+
// TracesDeserializer decodes bytes into data model.
23+
type TracesDeserializer interface {
24+
DeserializeTraces(bytes []byte) (interface{}, error)
2525
}
2626

27-
// LogsEncoder encodes data model into bytes.
28-
type LogsEncoder interface {
29-
EncodeLogs(model interface{}) ([]byte, error)
27+
// LogsDeserializer decodes bytes into data model.
28+
type LogsDeserializer interface {
29+
DeserializeLogs(bytes []byte) (interface{}, error)
3030
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414

1515
package encoding
1616

17-
// MetricsDecoder decodes bytes into data model.
18-
type MetricsDecoder interface {
19-
DecodeMetrics(bytes []byte) (interface{}, error)
17+
// MetricsSerializer encodes data model into bytes.
18+
type MetricsSerializer interface {
19+
SerializeMetrics(model interface{}) ([]byte, error)
2020
}
2121

22-
// TracesDecoder decodes bytes into data model.
23-
type TracesDecoder interface {
24-
DecodeTraces(bytes []byte) (interface{}, error)
22+
// TracesSerializer encodes data model into bytes.
23+
type TracesSerializer interface {
24+
SerializeTraces(model interface{}) ([]byte, error)
2525
}
2626

27-
// LogsDecoder decodes bytes into data model.
28-
type LogsDecoder interface {
29-
DecodeLogs(bytes []byte) (interface{}, error)
27+
// LogsSerializer encodes data model into bytes.
28+
type LogsSerializer interface {
29+
SerializeLogs(model interface{}) ([]byte, error)
3030
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ package encoding
1616

1717
import "fmt"
1818

19-
// Type is the encoding format that a model is serialized to.
20-
type Type string
19+
// Encoding is the encoding format that a model is serialized to.
20+
type Encoding string
2121

2222
const (
23-
Protobuf Type = "protobuf"
24-
JSON Type = "json"
25-
Thrift Type = "thrift"
23+
Protobuf Encoding = "protobuf"
24+
JSON Encoding = "json"
25+
Thrift Encoding = "thrift"
2626
)
2727

28-
func (e Type) String() string {
28+
func (e Encoding) String() string {
2929
return string(e)
3030
}
3131

3232
// ErrUnavailableEncoding is returned when the requested encoding is not supported.
3333
type ErrUnavailableEncoding struct {
34-
encoding Type
34+
encoding Encoding
3535
}
3636

3737
func (e *ErrUnavailableEncoding) Error() string {
3838
return fmt.Sprintf("unsupported encoding %q", e.encoding)
3939
}
4040

41-
func NewErrUnavailableEncoding(encoding Type) *ErrUnavailableEncoding {
41+
func NewErrUnavailableEncoding(encoding Encoding) *ErrUnavailableEncoding {
4242
return &ErrUnavailableEncoding{encoding: encoding}
4343
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ type MetricsDecoder interface {
2020
// ToMetrics converts a data model of another protocol into pdata.
2121
ToMetrics(src interface{}) (pdata.Metrics, error)
2222
// Type returns an instance of the model.
23-
Type() interface{}
23+
NewModel() interface{}
2424
}
2525

2626
type TracesDecoder interface {
2727
// ToTraces converts a data model of another protocol into pdata.
2828
ToTraces(src interface{}) (pdata.Traces, error)
29-
// Type returns an instance of the model.
30-
Type() interface{}
29+
// NewModel returns an instance of the model.
30+
NewModel() interface{}
3131
}
3232

3333
type LogsDecoder interface {
3434
// ToLogs converts a data model of another protocol into pdata.
3535
ToLogs(src interface{}) (pdata.Logs, error)
36-
// Type returns an instance of the model.
37-
Type() interface{}
36+
// NewModel returns an instance of the model.
37+
NewModel() interface{}
3838
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ import "go.opentelemetry.io/collector/consumer/pdata"
1919
type MetricsEncoder interface {
2020
// FromMetrics converts pdata to data model.
2121
FromMetrics(md pdata.Metrics, out interface{}) error
22-
// Type returns an instance of the model.
23-
Type() interface{}
22+
// NewModel returns an instance of the model.
23+
NewModel() interface{}
2424
}
2525

2626
type TracesEncoder interface {
2727
// FromTraces converts pdata to data model.
2828
FromTraces(md pdata.Traces, out interface{}) error
29-
// Type returns an instance of the model.
30-
Type() interface{}
29+
// NewModel returns an instance of the model.
30+
NewModel() interface{}
3131
}
3232

3333
type LogsEncoder interface {
3434
// FromLogs converts pdata to data model.
3535
FromLogs(md pdata.Logs, out interface{}) error
36-
// Type returns an instance of the model.
37-
Type() interface{}
36+
// NewModel returns an instance of the model.
37+
NewModel() interface{}
3838
}

protocols/README.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)