Skip to content

Commit 5611429

Browse files
authored
Merge pull request #29 from raintank/remove_unused_serialization_functionality
remove unused serialization functions, add one
2 parents 8b6139f + d8a78e4 commit 5611429

File tree

4 files changed

+64
-42
lines changed

4 files changed

+64
-42
lines changed

archive.go

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
)
99

1010
//go:generate stringer -type=Method -linecomment
11+
//go:generate msgp
12+
//msgp:ignore Method
1113

1214
// Archive represents a metric archive
1315
// the zero value represents a raw metric

archive_gen.go

+59
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

archive_gen_test.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

key.go

-42
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,12 @@ import (
66
"fmt"
77
"strconv"
88
"strings"
9-
10-
"github.com/tinylib/msgp/msgp"
119
)
1210

1311
//go:generate msgp
1412
//msgp:ignore AMKey
1513
// don't ignore Key, MKey because it's used for MetricDefinition
1614

17-
// A random number that does not conflict with any of the msgp internal
18-
// types, and which is also not the first one after the msgp internal types
19-
// to avoid accidental conflicts with other custom types
20-
const msgpExtensionId = 97
21-
22-
func init() {
23-
msgp.RegisterExtension(msgpExtensionId, func() msgp.Extension { return new(AMKey) })
24-
}
25-
2615
var ErrStringTooShort = errors.New("string too short")
2716
var ErrInvalidFormat = errors.New("invalid format")
2817

@@ -77,37 +66,6 @@ type AMKey struct {
7766
Archive Archive
7867
}
7968

80-
// ExtensionType is part of the msgp.Extension interface
81-
func (a *AMKey) ExtensionType() int8 {
82-
return msgpExtensionId
83-
}
84-
85-
// Len is part of the msgp.Extension interface
86-
// It returns the length of the encoded byte slice representing this AMKey
87-
// Length is variable because the AMKey may include the span & method,
88-
// also the org id can have a varying number of digits
89-
func (a *AMKey) Len() int {
90-
return len(a.String())
91-
}
92-
93-
// MarshalBinaryTo is part of the msgp.Extension interface
94-
// It takes a buffer which must have the length returned by the Len() function
95-
// and writes the encoded version of this AMKey into it
96-
func (a *AMKey) MarshalBinaryTo(buf []byte) error {
97-
copy(buf, a.String())
98-
99-
return nil
100-
}
101-
102-
// UnmarshalBinary is part of the msgp.Extension interface
103-
// It takes a buffer containing an encoded AMKey and decodes it into this
104-
// AMKey instance
105-
func (a *AMKey) UnmarshalBinary(buf []byte) error {
106-
var err error
107-
*a, err = AMKeyFromString(string(buf))
108-
return err
109-
}
110-
11169
func (a AMKey) String() string {
11270
if a.Archive == 0 {
11371
return a.MKey.String()

0 commit comments

Comments
 (0)