github.com/annchain/OG@v0.0.9/og/archive/archive_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 *Archive) 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.TxBase.DecodeMsg(dc)
    22  	if err != nil {
    23  		err = msgp.WrapError(err, "TxBase")
    24  		return
    25  	}
    26  	z.Data, err = dc.ReadBytes(z.Data)
    27  	if err != nil {
    28  		err = msgp.WrapError(err, "Data")
    29  		return
    30  	}
    31  	return
    32  }
    33  
    34  // EncodeMsg implements msgp.Encodable
    35  func (z *Archive) 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.TxBase.EncodeMsg(en)
    42  	if err != nil {
    43  		err = msgp.WrapError(err, "TxBase")
    44  		return
    45  	}
    46  	err = en.WriteBytes(z.Data)
    47  	if err != nil {
    48  		err = msgp.WrapError(err, "Data")
    49  		return
    50  	}
    51  	return
    52  }
    53  
    54  // MarshalMsg implements msgp.Marshaler
    55  func (z *Archive) 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.TxBase.MarshalMsg(o)
    60  	if err != nil {
    61  		err = msgp.WrapError(err, "TxBase")
    62  		return
    63  	}
    64  	o = msgp.AppendBytes(o, z.Data)
    65  	return
    66  }
    67  
    68  // UnmarshalMsg implements msgp.Unmarshaler
    69  func (z *Archive) 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.TxBase.UnmarshalMsg(bts)
    81  	if err != nil {
    82  		err = msgp.WrapError(err, "TxBase")
    83  		return
    84  	}
    85  	z.Data, bts, err = msgp.ReadBytesBytes(bts, z.Data)
    86  	if err != nil {
    87  		err = msgp.WrapError(err, "Data")
    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 *Archive) Msgsize() (s int) {
    96  	s = 1 + z.TxBase.Msgsize() + msgp.BytesPrefixSize + len(z.Data)
    97  	return
    98  }
    99  
   100  // DecodeMsg implements msgp.Decodable
   101  func (z *ArchiveJson) DecodeMsg(dc *msgp.Reader) (err error) {
   102  	var zb0001 uint32
   103  	zb0001, err = dc.ReadArrayHeader()
   104  	if err != nil {
   105  		err = msgp.WrapError(err)
   106  		return
   107  	}
   108  	if zb0001 != 2 {
   109  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
   110  		return
   111  	}
   112  	err = z.TxBaseJson.DecodeMsg(dc)
   113  	if err != nil {
   114  		err = msgp.WrapError(err, "TxBaseJson")
   115  		return
   116  	}
   117  	z.Data, err = dc.ReadBytes(z.Data)
   118  	if err != nil {
   119  		err = msgp.WrapError(err, "Data")
   120  		return
   121  	}
   122  	return
   123  }
   124  
   125  // EncodeMsg implements msgp.Encodable
   126  func (z *ArchiveJson) EncodeMsg(en *msgp.Writer) (err error) {
   127  	// array header, size 2
   128  	err = en.Append(0x92)
   129  	if err != nil {
   130  		return
   131  	}
   132  	err = z.TxBaseJson.EncodeMsg(en)
   133  	if err != nil {
   134  		err = msgp.WrapError(err, "TxBaseJson")
   135  		return
   136  	}
   137  	err = en.WriteBytes(z.Data)
   138  	if err != nil {
   139  		err = msgp.WrapError(err, "Data")
   140  		return
   141  	}
   142  	return
   143  }
   144  
   145  // MarshalMsg implements msgp.Marshaler
   146  func (z *ArchiveJson) MarshalMsg(b []byte) (o []byte, err error) {
   147  	o = msgp.Require(b, z.Msgsize())
   148  	// array header, size 2
   149  	o = append(o, 0x92)
   150  	o, err = z.TxBaseJson.MarshalMsg(o)
   151  	if err != nil {
   152  		err = msgp.WrapError(err, "TxBaseJson")
   153  		return
   154  	}
   155  	o = msgp.AppendBytes(o, z.Data)
   156  	return
   157  }
   158  
   159  // UnmarshalMsg implements msgp.Unmarshaler
   160  func (z *ArchiveJson) UnmarshalMsg(bts []byte) (o []byte, err error) {
   161  	var zb0001 uint32
   162  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
   163  	if err != nil {
   164  		err = msgp.WrapError(err)
   165  		return
   166  	}
   167  	if zb0001 != 2 {
   168  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
   169  		return
   170  	}
   171  	bts, err = z.TxBaseJson.UnmarshalMsg(bts)
   172  	if err != nil {
   173  		err = msgp.WrapError(err, "TxBaseJson")
   174  		return
   175  	}
   176  	z.Data, bts, err = msgp.ReadBytesBytes(bts, z.Data)
   177  	if err != nil {
   178  		err = msgp.WrapError(err, "Data")
   179  		return
   180  	}
   181  	o = bts
   182  	return
   183  }
   184  
   185  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   186  func (z *ArchiveJson) Msgsize() (s int) {
   187  	s = 1 + z.TxBaseJson.Msgsize() + msgp.BytesPrefixSize + len(z.Data)
   188  	return
   189  }
   190  
   191  // DecodeMsg implements msgp.Decodable
   192  func (z *Archives) DecodeMsg(dc *msgp.Reader) (err error) {
   193  	var zb0002 uint32
   194  	zb0002, err = dc.ReadArrayHeader()
   195  	if err != nil {
   196  		err = msgp.WrapError(err)
   197  		return
   198  	}
   199  	if cap((*z)) >= int(zb0002) {
   200  		(*z) = (*z)[:zb0002]
   201  	} else {
   202  		(*z) = make(Archives, zb0002)
   203  	}
   204  	for zb0001 := range *z {
   205  		if dc.IsNil() {
   206  			err = dc.ReadNil()
   207  			if err != nil {
   208  				err = msgp.WrapError(err, zb0001)
   209  				return
   210  			}
   211  			(*z)[zb0001] = nil
   212  		} else {
   213  			if (*z)[zb0001] == nil {
   214  				(*z)[zb0001] = new(Archive)
   215  			}
   216  			var zb0003 uint32
   217  			zb0003, err = dc.ReadArrayHeader()
   218  			if err != nil {
   219  				err = msgp.WrapError(err, zb0001)
   220  				return
   221  			}
   222  			if zb0003 != 2 {
   223  				err = msgp.ArrayError{Wanted: 2, Got: zb0003}
   224  				return
   225  			}
   226  			err = (*z)[zb0001].TxBase.DecodeMsg(dc)
   227  			if err != nil {
   228  				err = msgp.WrapError(err, zb0001, "TxBase")
   229  				return
   230  			}
   231  			(*z)[zb0001].Data, err = dc.ReadBytes((*z)[zb0001].Data)
   232  			if err != nil {
   233  				err = msgp.WrapError(err, zb0001, "Data")
   234  				return
   235  			}
   236  		}
   237  	}
   238  	return
   239  }
   240  
   241  // EncodeMsg implements msgp.Encodable
   242  func (z Archives) EncodeMsg(en *msgp.Writer) (err error) {
   243  	err = en.WriteArrayHeader(uint32(len(z)))
   244  	if err != nil {
   245  		err = msgp.WrapError(err)
   246  		return
   247  	}
   248  	for zb0004 := range z {
   249  		if z[zb0004] == nil {
   250  			err = en.WriteNil()
   251  			if err != nil {
   252  				return
   253  			}
   254  		} else {
   255  			// array header, size 2
   256  			err = en.Append(0x92)
   257  			if err != nil {
   258  				return
   259  			}
   260  			err = z[zb0004].TxBase.EncodeMsg(en)
   261  			if err != nil {
   262  				err = msgp.WrapError(err, zb0004, "TxBase")
   263  				return
   264  			}
   265  			err = en.WriteBytes(z[zb0004].Data)
   266  			if err != nil {
   267  				err = msgp.WrapError(err, zb0004, "Data")
   268  				return
   269  			}
   270  		}
   271  	}
   272  	return
   273  }
   274  
   275  // MarshalMsg implements msgp.Marshaler
   276  func (z Archives) MarshalMsg(b []byte) (o []byte, err error) {
   277  	o = msgp.Require(b, z.Msgsize())
   278  	o = msgp.AppendArrayHeader(o, uint32(len(z)))
   279  	for zb0004 := range z {
   280  		if z[zb0004] == nil {
   281  			o = msgp.AppendNil(o)
   282  		} else {
   283  			// array header, size 2
   284  			o = append(o, 0x92)
   285  			o, err = z[zb0004].TxBase.MarshalMsg(o)
   286  			if err != nil {
   287  				err = msgp.WrapError(err, zb0004, "TxBase")
   288  				return
   289  			}
   290  			o = msgp.AppendBytes(o, z[zb0004].Data)
   291  		}
   292  	}
   293  	return
   294  }
   295  
   296  // UnmarshalMsg implements msgp.Unmarshaler
   297  func (z *Archives) UnmarshalMsg(bts []byte) (o []byte, err error) {
   298  	var zb0002 uint32
   299  	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
   300  	if err != nil {
   301  		err = msgp.WrapError(err)
   302  		return
   303  	}
   304  	if cap((*z)) >= int(zb0002) {
   305  		(*z) = (*z)[:zb0002]
   306  	} else {
   307  		(*z) = make(Archives, zb0002)
   308  	}
   309  	for zb0001 := range *z {
   310  		if msgp.IsNil(bts) {
   311  			bts, err = msgp.ReadNilBytes(bts)
   312  			if err != nil {
   313  				return
   314  			}
   315  			(*z)[zb0001] = nil
   316  		} else {
   317  			if (*z)[zb0001] == nil {
   318  				(*z)[zb0001] = new(Archive)
   319  			}
   320  			var zb0003 uint32
   321  			zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts)
   322  			if err != nil {
   323  				err = msgp.WrapError(err, zb0001)
   324  				return
   325  			}
   326  			if zb0003 != 2 {
   327  				err = msgp.ArrayError{Wanted: 2, Got: zb0003}
   328  				return
   329  			}
   330  			bts, err = (*z)[zb0001].TxBase.UnmarshalMsg(bts)
   331  			if err != nil {
   332  				err = msgp.WrapError(err, zb0001, "TxBase")
   333  				return
   334  			}
   335  			(*z)[zb0001].Data, bts, err = msgp.ReadBytesBytes(bts, (*z)[zb0001].Data)
   336  			if err != nil {
   337  				err = msgp.WrapError(err, zb0001, "Data")
   338  				return
   339  			}
   340  		}
   341  	}
   342  	o = bts
   343  	return
   344  }
   345  
   346  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   347  func (z Archives) Msgsize() (s int) {
   348  	s = msgp.ArrayHeaderSize
   349  	for zb0004 := range z {
   350  		if z[zb0004] == nil {
   351  			s += msgp.NilSize
   352  		} else {
   353  			s += 1 + z[zb0004].TxBase.Msgsize() + msgp.BytesPrefixSize + len(z[zb0004].Data)
   354  		}
   355  	}
   356  	return
   357  }