@@ -6,23 +6,12 @@ import (
6
6
"fmt"
7
7
"strconv"
8
8
"strings"
9
-
10
- "github.com/tinylib/msgp/msgp"
11
9
)
12
10
13
11
//go:generate msgp
14
12
//msgp:ignore AMKey
15
13
// don't ignore Key, MKey because it's used for MetricDefinition
16
14
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
-
26
15
var ErrStringTooShort = errors .New ("string too short" )
27
16
var ErrInvalidFormat = errors .New ("invalid format" )
28
17
@@ -77,37 +66,6 @@ type AMKey struct {
77
66
Archive Archive
78
67
}
79
68
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
-
111
69
func (a AMKey ) String () string {
112
70
if a .Archive == 0 {
113
71
return a .MKey .String ()
0 commit comments