github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/cmd/tier_gen.go (about)

     1  package cmd
     2  
     3  // Code generated by github.com/tinylib/msgp DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/minio/madmin-go/v3"
     7  	"github.com/tinylib/msgp/msgp"
     8  )
     9  
    10  // DecodeMsg implements msgp.Decodable
    11  func (z *TierConfigMgr) DecodeMsg(dc *msgp.Reader) (err error) {
    12  	var field []byte
    13  	_ = field
    14  	var zb0001 uint32
    15  	zb0001, err = dc.ReadMapHeader()
    16  	if err != nil {
    17  		err = msgp.WrapError(err)
    18  		return
    19  	}
    20  	for zb0001 > 0 {
    21  		zb0001--
    22  		field, err = dc.ReadMapKeyPtr()
    23  		if err != nil {
    24  			err = msgp.WrapError(err)
    25  			return
    26  		}
    27  		switch msgp.UnsafeString(field) {
    28  		case "Tiers":
    29  			var zb0002 uint32
    30  			zb0002, err = dc.ReadMapHeader()
    31  			if err != nil {
    32  				err = msgp.WrapError(err, "Tiers")
    33  				return
    34  			}
    35  			if z.Tiers == nil {
    36  				z.Tiers = make(map[string]madmin.TierConfig, zb0002)
    37  			} else if len(z.Tiers) > 0 {
    38  				for key := range z.Tiers {
    39  					delete(z.Tiers, key)
    40  				}
    41  			}
    42  			for zb0002 > 0 {
    43  				zb0002--
    44  				var za0001 string
    45  				var za0002 madmin.TierConfig
    46  				za0001, err = dc.ReadString()
    47  				if err != nil {
    48  					err = msgp.WrapError(err, "Tiers")
    49  					return
    50  				}
    51  				err = za0002.DecodeMsg(dc)
    52  				if err != nil {
    53  					err = msgp.WrapError(err, "Tiers", za0001)
    54  					return
    55  				}
    56  				z.Tiers[za0001] = za0002
    57  			}
    58  		default:
    59  			err = dc.Skip()
    60  			if err != nil {
    61  				err = msgp.WrapError(err)
    62  				return
    63  			}
    64  		}
    65  	}
    66  	return
    67  }
    68  
    69  // EncodeMsg implements msgp.Encodable
    70  func (z *TierConfigMgr) EncodeMsg(en *msgp.Writer) (err error) {
    71  	// map header, size 1
    72  	// write "Tiers"
    73  	err = en.Append(0x81, 0xa5, 0x54, 0x69, 0x65, 0x72, 0x73)
    74  	if err != nil {
    75  		return
    76  	}
    77  	err = en.WriteMapHeader(uint32(len(z.Tiers)))
    78  	if err != nil {
    79  		err = msgp.WrapError(err, "Tiers")
    80  		return
    81  	}
    82  	for za0001, za0002 := range z.Tiers {
    83  		err = en.WriteString(za0001)
    84  		if err != nil {
    85  			err = msgp.WrapError(err, "Tiers")
    86  			return
    87  		}
    88  		err = za0002.EncodeMsg(en)
    89  		if err != nil {
    90  			err = msgp.WrapError(err, "Tiers", za0001)
    91  			return
    92  		}
    93  	}
    94  	return
    95  }
    96  
    97  // MarshalMsg implements msgp.Marshaler
    98  func (z *TierConfigMgr) MarshalMsg(b []byte) (o []byte, err error) {
    99  	o = msgp.Require(b, z.Msgsize())
   100  	// map header, size 1
   101  	// string "Tiers"
   102  	o = append(o, 0x81, 0xa5, 0x54, 0x69, 0x65, 0x72, 0x73)
   103  	o = msgp.AppendMapHeader(o, uint32(len(z.Tiers)))
   104  	for za0001, za0002 := range z.Tiers {
   105  		o = msgp.AppendString(o, za0001)
   106  		o, err = za0002.MarshalMsg(o)
   107  		if err != nil {
   108  			err = msgp.WrapError(err, "Tiers", za0001)
   109  			return
   110  		}
   111  	}
   112  	return
   113  }
   114  
   115  // UnmarshalMsg implements msgp.Unmarshaler
   116  func (z *TierConfigMgr) UnmarshalMsg(bts []byte) (o []byte, err error) {
   117  	var field []byte
   118  	_ = field
   119  	var zb0001 uint32
   120  	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
   121  	if err != nil {
   122  		err = msgp.WrapError(err)
   123  		return
   124  	}
   125  	for zb0001 > 0 {
   126  		zb0001--
   127  		field, bts, err = msgp.ReadMapKeyZC(bts)
   128  		if err != nil {
   129  			err = msgp.WrapError(err)
   130  			return
   131  		}
   132  		switch msgp.UnsafeString(field) {
   133  		case "Tiers":
   134  			var zb0002 uint32
   135  			zb0002, bts, err = msgp.ReadMapHeaderBytes(bts)
   136  			if err != nil {
   137  				err = msgp.WrapError(err, "Tiers")
   138  				return
   139  			}
   140  			if z.Tiers == nil {
   141  				z.Tiers = make(map[string]madmin.TierConfig, zb0002)
   142  			} else if len(z.Tiers) > 0 {
   143  				for key := range z.Tiers {
   144  					delete(z.Tiers, key)
   145  				}
   146  			}
   147  			for zb0002 > 0 {
   148  				var za0001 string
   149  				var za0002 madmin.TierConfig
   150  				zb0002--
   151  				za0001, bts, err = msgp.ReadStringBytes(bts)
   152  				if err != nil {
   153  					err = msgp.WrapError(err, "Tiers")
   154  					return
   155  				}
   156  				bts, err = za0002.UnmarshalMsg(bts)
   157  				if err != nil {
   158  					err = msgp.WrapError(err, "Tiers", za0001)
   159  					return
   160  				}
   161  				z.Tiers[za0001] = za0002
   162  			}
   163  		default:
   164  			bts, err = msgp.Skip(bts)
   165  			if err != nil {
   166  				err = msgp.WrapError(err)
   167  				return
   168  			}
   169  		}
   170  	}
   171  	o = bts
   172  	return
   173  }
   174  
   175  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   176  func (z *TierConfigMgr) Msgsize() (s int) {
   177  	s = 1 + 6 + msgp.MapHeaderSize
   178  	if z.Tiers != nil {
   179  		for za0001, za0002 := range z.Tiers {
   180  			_ = za0002
   181  			s += msgp.StringPrefixSize + len(za0001) + za0002.Msgsize()
   182  		}
   183  	}
   184  	return
   185  }