github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/cdc/model/kv_gen.go (about)

     1  package model
     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 *OpType) DecodeMsg(dc *msgp.Reader) (err error) {
    11  	{
    12  		var zb0001 int
    13  		zb0001, err = dc.ReadInt()
    14  		if err != nil {
    15  			err = msgp.WrapError(err)
    16  			return
    17  		}
    18  		(*z) = OpType(zb0001)
    19  	}
    20  	return
    21  }
    22  
    23  // EncodeMsg implements msgp.Encodable
    24  func (z OpType) EncodeMsg(en *msgp.Writer) (err error) {
    25  	err = en.WriteInt(int(z))
    26  	if err != nil {
    27  		err = msgp.WrapError(err)
    28  		return
    29  	}
    30  	return
    31  }
    32  
    33  // MarshalMsg implements msgp.Marshaler
    34  func (z OpType) MarshalMsg(b []byte) (o []byte, err error) {
    35  	o = msgp.Require(b, z.Msgsize())
    36  	o = msgp.AppendInt(o, int(z))
    37  	return
    38  }
    39  
    40  // UnmarshalMsg implements msgp.Unmarshaler
    41  func (z *OpType) UnmarshalMsg(bts []byte) (o []byte, err error) {
    42  	{
    43  		var zb0001 int
    44  		zb0001, bts, err = msgp.ReadIntBytes(bts)
    45  		if err != nil {
    46  			err = msgp.WrapError(err)
    47  			return
    48  		}
    49  		(*z) = OpType(zb0001)
    50  	}
    51  	o = bts
    52  	return
    53  }
    54  
    55  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
    56  func (z OpType) Msgsize() (s int) {
    57  	s = msgp.IntSize
    58  	return
    59  }
    60  
    61  // DecodeMsg implements msgp.Decodable
    62  func (z *RawKVEntry) DecodeMsg(dc *msgp.Reader) (err error) {
    63  	var field []byte
    64  	_ = field
    65  	var zb0001 uint32
    66  	zb0001, err = dc.ReadMapHeader()
    67  	if err != nil {
    68  		err = msgp.WrapError(err)
    69  		return
    70  	}
    71  	for zb0001 > 0 {
    72  		zb0001--
    73  		field, err = dc.ReadMapKeyPtr()
    74  		if err != nil {
    75  			err = msgp.WrapError(err)
    76  			return
    77  		}
    78  		switch msgp.UnsafeString(field) {
    79  		case "op_type":
    80  			{
    81  				var zb0002 int
    82  				zb0002, err = dc.ReadInt()
    83  				if err != nil {
    84  					err = msgp.WrapError(err, "OpType")
    85  					return
    86  				}
    87  				z.OpType = OpType(zb0002)
    88  			}
    89  		case "key":
    90  			z.Key, err = dc.ReadBytes(z.Key)
    91  			if err != nil {
    92  				err = msgp.WrapError(err, "Key")
    93  				return
    94  			}
    95  		case "value":
    96  			z.Value, err = dc.ReadBytes(z.Value)
    97  			if err != nil {
    98  				err = msgp.WrapError(err, "Value")
    99  				return
   100  			}
   101  		case "old_value":
   102  			z.OldValue, err = dc.ReadBytes(z.OldValue)
   103  			if err != nil {
   104  				err = msgp.WrapError(err, "OldValue")
   105  				return
   106  			}
   107  		case "start_ts":
   108  			z.StartTs, err = dc.ReadUint64()
   109  			if err != nil {
   110  				err = msgp.WrapError(err, "StartTs")
   111  				return
   112  			}
   113  		case "crts":
   114  			z.CRTs, err = dc.ReadUint64()
   115  			if err != nil {
   116  				err = msgp.WrapError(err, "CRTs")
   117  				return
   118  			}
   119  		case "region_id":
   120  			z.RegionID, err = dc.ReadUint64()
   121  			if err != nil {
   122  				err = msgp.WrapError(err, "RegionID")
   123  				return
   124  			}
   125  		default:
   126  			err = dc.Skip()
   127  			if err != nil {
   128  				err = msgp.WrapError(err)
   129  				return
   130  			}
   131  		}
   132  	}
   133  	return
   134  }
   135  
   136  // EncodeMsg implements msgp.Encodable
   137  func (z *RawKVEntry) EncodeMsg(en *msgp.Writer) (err error) {
   138  	// map header, size 7
   139  	// write "op_type"
   140  	err = en.Append(0x87, 0xa7, 0x6f, 0x70, 0x5f, 0x74, 0x79, 0x70, 0x65)
   141  	if err != nil {
   142  		return
   143  	}
   144  	err = en.WriteInt(int(z.OpType))
   145  	if err != nil {
   146  		err = msgp.WrapError(err, "OpType")
   147  		return
   148  	}
   149  	// write "key"
   150  	err = en.Append(0xa3, 0x6b, 0x65, 0x79)
   151  	if err != nil {
   152  		return
   153  	}
   154  	err = en.WriteBytes(z.Key)
   155  	if err != nil {
   156  		err = msgp.WrapError(err, "Key")
   157  		return
   158  	}
   159  	// write "value"
   160  	err = en.Append(0xa5, 0x76, 0x61, 0x6c, 0x75, 0x65)
   161  	if err != nil {
   162  		return
   163  	}
   164  	err = en.WriteBytes(z.Value)
   165  	if err != nil {
   166  		err = msgp.WrapError(err, "Value")
   167  		return
   168  	}
   169  	// write "old_value"
   170  	err = en.Append(0xa9, 0x6f, 0x6c, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
   171  	if err != nil {
   172  		return
   173  	}
   174  	err = en.WriteBytes(z.OldValue)
   175  	if err != nil {
   176  		err = msgp.WrapError(err, "OldValue")
   177  		return
   178  	}
   179  	// write "start_ts"
   180  	err = en.Append(0xa8, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x73)
   181  	if err != nil {
   182  		return
   183  	}
   184  	err = en.WriteUint64(z.StartTs)
   185  	if err != nil {
   186  		err = msgp.WrapError(err, "StartTs")
   187  		return
   188  	}
   189  	// write "crts"
   190  	err = en.Append(0xa4, 0x63, 0x72, 0x74, 0x73)
   191  	if err != nil {
   192  		return
   193  	}
   194  	err = en.WriteUint64(z.CRTs)
   195  	if err != nil {
   196  		err = msgp.WrapError(err, "CRTs")
   197  		return
   198  	}
   199  	// write "region_id"
   200  	err = en.Append(0xa9, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64)
   201  	if err != nil {
   202  		return
   203  	}
   204  	err = en.WriteUint64(z.RegionID)
   205  	if err != nil {
   206  		err = msgp.WrapError(err, "RegionID")
   207  		return
   208  	}
   209  	return
   210  }
   211  
   212  // MarshalMsg implements msgp.Marshaler
   213  func (z *RawKVEntry) MarshalMsg(b []byte) (o []byte, err error) {
   214  	o = msgp.Require(b, z.Msgsize())
   215  	// map header, size 7
   216  	// string "op_type"
   217  	o = append(o, 0x87, 0xa7, 0x6f, 0x70, 0x5f, 0x74, 0x79, 0x70, 0x65)
   218  	o = msgp.AppendInt(o, int(z.OpType))
   219  	// string "key"
   220  	o = append(o, 0xa3, 0x6b, 0x65, 0x79)
   221  	o = msgp.AppendBytes(o, z.Key)
   222  	// string "value"
   223  	o = append(o, 0xa5, 0x76, 0x61, 0x6c, 0x75, 0x65)
   224  	o = msgp.AppendBytes(o, z.Value)
   225  	// string "old_value"
   226  	o = append(o, 0xa9, 0x6f, 0x6c, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65)
   227  	o = msgp.AppendBytes(o, z.OldValue)
   228  	// string "start_ts"
   229  	o = append(o, 0xa8, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x73)
   230  	o = msgp.AppendUint64(o, z.StartTs)
   231  	// string "crts"
   232  	o = append(o, 0xa4, 0x63, 0x72, 0x74, 0x73)
   233  	o = msgp.AppendUint64(o, z.CRTs)
   234  	// string "region_id"
   235  	o = append(o, 0xa9, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64)
   236  	o = msgp.AppendUint64(o, z.RegionID)
   237  	return
   238  }
   239  
   240  // UnmarshalMsg implements msgp.Unmarshaler
   241  func (z *RawKVEntry) UnmarshalMsg(bts []byte) (o []byte, err error) {
   242  	var field []byte
   243  	_ = field
   244  	var zb0001 uint32
   245  	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
   246  	if err != nil {
   247  		err = msgp.WrapError(err)
   248  		return
   249  	}
   250  	for zb0001 > 0 {
   251  		zb0001--
   252  		field, bts, err = msgp.ReadMapKeyZC(bts)
   253  		if err != nil {
   254  			err = msgp.WrapError(err)
   255  			return
   256  		}
   257  		switch msgp.UnsafeString(field) {
   258  		case "op_type":
   259  			{
   260  				var zb0002 int
   261  				zb0002, bts, err = msgp.ReadIntBytes(bts)
   262  				if err != nil {
   263  					err = msgp.WrapError(err, "OpType")
   264  					return
   265  				}
   266  				z.OpType = OpType(zb0002)
   267  			}
   268  		case "key":
   269  			z.Key, bts, err = msgp.ReadBytesBytes(bts, z.Key)
   270  			if err != nil {
   271  				err = msgp.WrapError(err, "Key")
   272  				return
   273  			}
   274  		case "value":
   275  			z.Value, bts, err = msgp.ReadBytesBytes(bts, z.Value)
   276  			if err != nil {
   277  				err = msgp.WrapError(err, "Value")
   278  				return
   279  			}
   280  		case "old_value":
   281  			z.OldValue, bts, err = msgp.ReadBytesBytes(bts, z.OldValue)
   282  			if err != nil {
   283  				err = msgp.WrapError(err, "OldValue")
   284  				return
   285  			}
   286  		case "start_ts":
   287  			z.StartTs, bts, err = msgp.ReadUint64Bytes(bts)
   288  			if err != nil {
   289  				err = msgp.WrapError(err, "StartTs")
   290  				return
   291  			}
   292  		case "crts":
   293  			z.CRTs, bts, err = msgp.ReadUint64Bytes(bts)
   294  			if err != nil {
   295  				err = msgp.WrapError(err, "CRTs")
   296  				return
   297  			}
   298  		case "region_id":
   299  			z.RegionID, bts, err = msgp.ReadUint64Bytes(bts)
   300  			if err != nil {
   301  				err = msgp.WrapError(err, "RegionID")
   302  				return
   303  			}
   304  		default:
   305  			bts, err = msgp.Skip(bts)
   306  			if err != nil {
   307  				err = msgp.WrapError(err)
   308  				return
   309  			}
   310  		}
   311  	}
   312  	o = bts
   313  	return
   314  }
   315  
   316  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   317  func (z *RawKVEntry) Msgsize() (s int) {
   318  	s = 1 + 8 + msgp.IntSize + 4 + msgp.BytesPrefixSize + len(z.Key) + 6 + msgp.BytesPrefixSize + len(z.Value) + 10 + msgp.BytesPrefixSize + len(z.OldValue) + 9 + msgp.Uint64Size + 5 + msgp.Uint64Size + 10 + msgp.Uint64Size
   319  	return
   320  }