github.com/annchain/OG@v0.0.9/p2p/onode/node_gen.go (about) 1 package onode 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 *ID) DecodeMsg(dc *msgp.Reader) (err error) { 11 err = dc.ReadExactBytes((z)[:]) 12 if err != nil { 13 return 14 } 15 return 16 } 17 18 // EncodeMsg implements msgp.Encodable 19 func (z *ID) EncodeMsg(en *msgp.Writer) (err error) { 20 err = en.WriteBytes((z)[:]) 21 if err != nil { 22 return 23 } 24 return 25 } 26 27 // MarshalMsg implements msgp.Marshaler 28 func (z *ID) MarshalMsg(b []byte) (o []byte, err error) { 29 o = msgp.Require(b, z.Msgsize()) 30 o = msgp.AppendBytes(o, (z)[:]) 31 return 32 } 33 34 // UnmarshalMsg implements msgp.Unmarshaler 35 func (z *ID) UnmarshalMsg(bts []byte) (o []byte, err error) { 36 bts, err = msgp.ReadExactBytes(bts, (z)[:]) 37 if err != nil { 38 return 39 } 40 o = bts 41 return 42 } 43 44 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 45 func (z *ID) Msgsize() (s int) { 46 s = msgp.ArrayHeaderSize + (32 * (msgp.ByteSize)) 47 return 48 } 49 50 // DecodeMsg implements msgp.Decodable 51 func (z *Node) DecodeMsg(dc *msgp.Reader) (err error) { 52 var field []byte 53 _ = field 54 var zb0001 uint32 55 zb0001, err = dc.ReadMapHeader() 56 if err != nil { 57 return 58 } 59 for zb0001 > 0 { 60 zb0001-- 61 field, err = dc.ReadMapKeyPtr() 62 if err != nil { 63 return 64 } 65 switch msgp.UnsafeString(field) { 66 default: 67 err = dc.Skip() 68 if err != nil { 69 return 70 } 71 } 72 } 73 return 74 } 75 76 // EncodeMsg implements msgp.Encodable 77 func (z Node) EncodeMsg(en *msgp.Writer) (err error) { 78 // map header, size 0 79 err = en.Append(0x80) 80 if err != nil { 81 return 82 } 83 return 84 } 85 86 // MarshalMsg implements msgp.Marshaler 87 func (z Node) MarshalMsg(b []byte) (o []byte, err error) { 88 o = msgp.Require(b, z.Msgsize()) 89 // map header, size 0 90 o = append(o, 0x80) 91 return 92 } 93 94 // UnmarshalMsg implements msgp.Unmarshaler 95 func (z *Node) UnmarshalMsg(bts []byte) (o []byte, err error) { 96 var field []byte 97 _ = field 98 var zb0001 uint32 99 zb0001, bts, err = msgp.ReadMapHeaderBytes(bts) 100 if err != nil { 101 return 102 } 103 for zb0001 > 0 { 104 zb0001-- 105 field, bts, err = msgp.ReadMapKeyZC(bts) 106 if err != nil { 107 return 108 } 109 switch msgp.UnsafeString(field) { 110 default: 111 bts, err = msgp.Skip(bts) 112 if err != nil { 113 return 114 } 115 } 116 } 117 o = bts 118 return 119 } 120 121 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 122 func (z Node) Msgsize() (s int) { 123 s = 1 124 return 125 }