github.com/annchain/OG@v0.0.9/plugin/annsensus/message_gen.go (about)

     1  package annsensus
     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 *GeneralMessageAnnsensus) 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 != 2 {
    18  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
    19  		return
    20  	}
    21  	err = z.InnerMessageType.DecodeMsg(dc)
    22  	if err != nil {
    23  		err = msgp.WrapError(err, "InnerMessageType")
    24  		return
    25  	}
    26  	z.InnerMessage, err = dc.ReadBytes(z.InnerMessage)
    27  	if err != nil {
    28  		err = msgp.WrapError(err, "InnerMessage")
    29  		return
    30  	}
    31  	return
    32  }
    33  
    34  // EncodeMsg implements msgp.Encodable
    35  func (z *GeneralMessageAnnsensus) EncodeMsg(en *msgp.Writer) (err error) {
    36  	// array header, size 2
    37  	err = en.Append(0x92)
    38  	if err != nil {
    39  		return
    40  	}
    41  	err = z.InnerMessageType.EncodeMsg(en)
    42  	if err != nil {
    43  		err = msgp.WrapError(err, "InnerMessageType")
    44  		return
    45  	}
    46  	err = en.WriteBytes(z.InnerMessage)
    47  	if err != nil {
    48  		err = msgp.WrapError(err, "InnerMessage")
    49  		return
    50  	}
    51  	return
    52  }
    53  
    54  // MarshalMsg implements msgp.Marshaler
    55  func (z *GeneralMessageAnnsensus) MarshalMsg(b []byte) (o []byte, err error) {
    56  	o = msgp.Require(b, z.Msgsize())
    57  	// array header, size 2
    58  	o = append(o, 0x92)
    59  	o, err = z.InnerMessageType.MarshalMsg(o)
    60  	if err != nil {
    61  		err = msgp.WrapError(err, "InnerMessageType")
    62  		return
    63  	}
    64  	o = msgp.AppendBytes(o, z.InnerMessage)
    65  	return
    66  }
    67  
    68  // UnmarshalMsg implements msgp.Unmarshaler
    69  func (z *GeneralMessageAnnsensus) UnmarshalMsg(bts []byte) (o []byte, err error) {
    70  	var zb0001 uint32
    71  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
    72  	if err != nil {
    73  		err = msgp.WrapError(err)
    74  		return
    75  	}
    76  	if zb0001 != 2 {
    77  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
    78  		return
    79  	}
    80  	bts, err = z.InnerMessageType.UnmarshalMsg(bts)
    81  	if err != nil {
    82  		err = msgp.WrapError(err, "InnerMessageType")
    83  		return
    84  	}
    85  	z.InnerMessage, bts, err = msgp.ReadBytesBytes(bts, z.InnerMessage)
    86  	if err != nil {
    87  		err = msgp.WrapError(err, "InnerMessage")
    88  		return
    89  	}
    90  	o = bts
    91  	return
    92  }
    93  
    94  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
    95  func (z *GeneralMessageAnnsensus) Msgsize() (s int) {
    96  	s = 1 + z.InnerMessageType.Msgsize() + msgp.BytesPrefixSize + len(z.InnerMessage)
    97  	return
    98  }