github.com/annchain/OG@v0.0.9/og/archive/message_gen.go (about) 1 package archive 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "github.com/tinylib/msgp/msgp" 7 ) 8 9 // DecodeMsg implements msgp.Decodable 10 func (z *MessageNewArchive) DecodeMsg(dc *msgp.Reader) (err error) { 11 var zb0001 uint32 12 zb0001, err = dc.ReadArrayHeader() 13 if err != nil { 14 err = msgp.WrapError(err) 15 return 16 } 17 if zb0001 != 1 { 18 err = msgp.ArrayError{Wanted: 1, Got: zb0001} 19 return 20 } 21 if dc.IsNil() { 22 err = dc.ReadNil() 23 if err != nil { 24 err = msgp.WrapError(err, "Archive") 25 return 26 } 27 z.Archive = nil 28 } else { 29 if z.Archive == nil { 30 z.Archive = new(Archive) 31 } 32 err = z.Archive.DecodeMsg(dc) 33 if err != nil { 34 err = msgp.WrapError(err, "Archive") 35 return 36 } 37 } 38 return 39 } 40 41 // EncodeMsg implements msgp.Encodable 42 func (z *MessageNewArchive) EncodeMsg(en *msgp.Writer) (err error) { 43 // array header, size 1 44 err = en.Append(0x91) 45 if err != nil { 46 return 47 } 48 if z.Archive == nil { 49 err = en.WriteNil() 50 if err != nil { 51 return 52 } 53 } else { 54 err = z.Archive.EncodeMsg(en) 55 if err != nil { 56 err = msgp.WrapError(err, "Archive") 57 return 58 } 59 } 60 return 61 } 62 63 // MarshalMsg implements msgp.Marshaler 64 func (z *MessageNewArchive) MarshalMsg(b []byte) (o []byte, err error) { 65 o = msgp.Require(b, z.Msgsize()) 66 // array header, size 1 67 o = append(o, 0x91) 68 if z.Archive == nil { 69 o = msgp.AppendNil(o) 70 } else { 71 o, err = z.Archive.MarshalMsg(o) 72 if err != nil { 73 err = msgp.WrapError(err, "Archive") 74 return 75 } 76 } 77 return 78 } 79 80 // UnmarshalMsg implements msgp.Unmarshaler 81 func (z *MessageNewArchive) UnmarshalMsg(bts []byte) (o []byte, err error) { 82 var zb0001 uint32 83 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 84 if err != nil { 85 err = msgp.WrapError(err) 86 return 87 } 88 if zb0001 != 1 { 89 err = msgp.ArrayError{Wanted: 1, Got: zb0001} 90 return 91 } 92 if msgp.IsNil(bts) { 93 bts, err = msgp.ReadNilBytes(bts) 94 if err != nil { 95 return 96 } 97 z.Archive = nil 98 } else { 99 if z.Archive == nil { 100 z.Archive = new(Archive) 101 } 102 bts, err = z.Archive.UnmarshalMsg(bts) 103 if err != nil { 104 err = msgp.WrapError(err, "Archive") 105 return 106 } 107 } 108 o = bts 109 return 110 } 111 112 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 113 func (z *MessageNewArchive) Msgsize() (s int) { 114 s = 1 115 if z.Archive == nil { 116 s += msgp.NilSize 117 } else { 118 s += z.Archive.Msgsize() 119 } 120 return 121 }