github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/cmd/storage-rest-common_gen.go (about) 1 package cmd 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 *nsScannerOptions) DecodeMsg(dc *msgp.Reader) (err error) { 11 var field []byte 12 _ = field 13 var zb0001 uint32 14 zb0001, err = dc.ReadMapHeader() 15 if err != nil { 16 err = msgp.WrapError(err) 17 return 18 } 19 for zb0001 > 0 { 20 zb0001-- 21 field, err = dc.ReadMapKeyPtr() 22 if err != nil { 23 err = msgp.WrapError(err) 24 return 25 } 26 switch msgp.UnsafeString(field) { 27 case "id": 28 z.DiskID, err = dc.ReadString() 29 if err != nil { 30 err = msgp.WrapError(err, "DiskID") 31 return 32 } 33 case "m": 34 z.ScanMode, err = dc.ReadInt() 35 if err != nil { 36 err = msgp.WrapError(err, "ScanMode") 37 return 38 } 39 case "c": 40 if dc.IsNil() { 41 err = dc.ReadNil() 42 if err != nil { 43 err = msgp.WrapError(err, "Cache") 44 return 45 } 46 z.Cache = nil 47 } else { 48 if z.Cache == nil { 49 z.Cache = new(dataUsageCache) 50 } 51 err = z.Cache.DecodeMsg(dc) 52 if err != nil { 53 err = msgp.WrapError(err, "Cache") 54 return 55 } 56 } 57 default: 58 err = dc.Skip() 59 if err != nil { 60 err = msgp.WrapError(err) 61 return 62 } 63 } 64 } 65 return 66 } 67 68 // EncodeMsg implements msgp.Encodable 69 func (z *nsScannerOptions) EncodeMsg(en *msgp.Writer) (err error) { 70 // map header, size 3 71 // write "id" 72 err = en.Append(0x83, 0xa2, 0x69, 0x64) 73 if err != nil { 74 return 75 } 76 err = en.WriteString(z.DiskID) 77 if err != nil { 78 err = msgp.WrapError(err, "DiskID") 79 return 80 } 81 // write "m" 82 err = en.Append(0xa1, 0x6d) 83 if err != nil { 84 return 85 } 86 err = en.WriteInt(z.ScanMode) 87 if err != nil { 88 err = msgp.WrapError(err, "ScanMode") 89 return 90 } 91 // write "c" 92 err = en.Append(0xa1, 0x63) 93 if err != nil { 94 return 95 } 96 if z.Cache == nil { 97 err = en.WriteNil() 98 if err != nil { 99 return 100 } 101 } else { 102 err = z.Cache.EncodeMsg(en) 103 if err != nil { 104 err = msgp.WrapError(err, "Cache") 105 return 106 } 107 } 108 return 109 } 110 111 // MarshalMsg implements msgp.Marshaler 112 func (z *nsScannerOptions) MarshalMsg(b []byte) (o []byte, err error) { 113 o = msgp.Require(b, z.Msgsize()) 114 // map header, size 3 115 // string "id" 116 o = append(o, 0x83, 0xa2, 0x69, 0x64) 117 o = msgp.AppendString(o, z.DiskID) 118 // string "m" 119 o = append(o, 0xa1, 0x6d) 120 o = msgp.AppendInt(o, z.ScanMode) 121 // string "c" 122 o = append(o, 0xa1, 0x63) 123 if z.Cache == nil { 124 o = msgp.AppendNil(o) 125 } else { 126 o, err = z.Cache.MarshalMsg(o) 127 if err != nil { 128 err = msgp.WrapError(err, "Cache") 129 return 130 } 131 } 132 return 133 } 134 135 // UnmarshalMsg implements msgp.Unmarshaler 136 func (z *nsScannerOptions) UnmarshalMsg(bts []byte) (o []byte, err error) { 137 var field []byte 138 _ = field 139 var zb0001 uint32 140 zb0001, bts, err = msgp.ReadMapHeaderBytes(bts) 141 if err != nil { 142 err = msgp.WrapError(err) 143 return 144 } 145 for zb0001 > 0 { 146 zb0001-- 147 field, bts, err = msgp.ReadMapKeyZC(bts) 148 if err != nil { 149 err = msgp.WrapError(err) 150 return 151 } 152 switch msgp.UnsafeString(field) { 153 case "id": 154 z.DiskID, bts, err = msgp.ReadStringBytes(bts) 155 if err != nil { 156 err = msgp.WrapError(err, "DiskID") 157 return 158 } 159 case "m": 160 z.ScanMode, bts, err = msgp.ReadIntBytes(bts) 161 if err != nil { 162 err = msgp.WrapError(err, "ScanMode") 163 return 164 } 165 case "c": 166 if msgp.IsNil(bts) { 167 bts, err = msgp.ReadNilBytes(bts) 168 if err != nil { 169 return 170 } 171 z.Cache = nil 172 } else { 173 if z.Cache == nil { 174 z.Cache = new(dataUsageCache) 175 } 176 bts, err = z.Cache.UnmarshalMsg(bts) 177 if err != nil { 178 err = msgp.WrapError(err, "Cache") 179 return 180 } 181 } 182 default: 183 bts, err = msgp.Skip(bts) 184 if err != nil { 185 err = msgp.WrapError(err) 186 return 187 } 188 } 189 } 190 o = bts 191 return 192 } 193 194 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 195 func (z *nsScannerOptions) Msgsize() (s int) { 196 s = 1 + 3 + msgp.StringPrefixSize + len(z.DiskID) + 2 + msgp.IntSize + 2 197 if z.Cache == nil { 198 s += msgp.NilSize 199 } else { 200 s += z.Cache.Msgsize() 201 } 202 return 203 } 204 205 // DecodeMsg implements msgp.Decodable 206 func (z *nsScannerResp) DecodeMsg(dc *msgp.Reader) (err error) { 207 var field []byte 208 _ = field 209 var zb0001 uint32 210 zb0001, err = dc.ReadMapHeader() 211 if err != nil { 212 err = msgp.WrapError(err) 213 return 214 } 215 for zb0001 > 0 { 216 zb0001-- 217 field, err = dc.ReadMapKeyPtr() 218 if err != nil { 219 err = msgp.WrapError(err) 220 return 221 } 222 switch msgp.UnsafeString(field) { 223 case "u": 224 if dc.IsNil() { 225 err = dc.ReadNil() 226 if err != nil { 227 err = msgp.WrapError(err, "Update") 228 return 229 } 230 z.Update = nil 231 } else { 232 if z.Update == nil { 233 z.Update = new(dataUsageEntry) 234 } 235 err = z.Update.DecodeMsg(dc) 236 if err != nil { 237 err = msgp.WrapError(err, "Update") 238 return 239 } 240 } 241 case "f": 242 if dc.IsNil() { 243 err = dc.ReadNil() 244 if err != nil { 245 err = msgp.WrapError(err, "Final") 246 return 247 } 248 z.Final = nil 249 } else { 250 if z.Final == nil { 251 z.Final = new(dataUsageCache) 252 } 253 err = z.Final.DecodeMsg(dc) 254 if err != nil { 255 err = msgp.WrapError(err, "Final") 256 return 257 } 258 } 259 default: 260 err = dc.Skip() 261 if err != nil { 262 err = msgp.WrapError(err) 263 return 264 } 265 } 266 } 267 return 268 } 269 270 // EncodeMsg implements msgp.Encodable 271 func (z *nsScannerResp) EncodeMsg(en *msgp.Writer) (err error) { 272 // map header, size 2 273 // write "u" 274 err = en.Append(0x82, 0xa1, 0x75) 275 if err != nil { 276 return 277 } 278 if z.Update == nil { 279 err = en.WriteNil() 280 if err != nil { 281 return 282 } 283 } else { 284 err = z.Update.EncodeMsg(en) 285 if err != nil { 286 err = msgp.WrapError(err, "Update") 287 return 288 } 289 } 290 // write "f" 291 err = en.Append(0xa1, 0x66) 292 if err != nil { 293 return 294 } 295 if z.Final == nil { 296 err = en.WriteNil() 297 if err != nil { 298 return 299 } 300 } else { 301 err = z.Final.EncodeMsg(en) 302 if err != nil { 303 err = msgp.WrapError(err, "Final") 304 return 305 } 306 } 307 return 308 } 309 310 // MarshalMsg implements msgp.Marshaler 311 func (z *nsScannerResp) MarshalMsg(b []byte) (o []byte, err error) { 312 o = msgp.Require(b, z.Msgsize()) 313 // map header, size 2 314 // string "u" 315 o = append(o, 0x82, 0xa1, 0x75) 316 if z.Update == nil { 317 o = msgp.AppendNil(o) 318 } else { 319 o, err = z.Update.MarshalMsg(o) 320 if err != nil { 321 err = msgp.WrapError(err, "Update") 322 return 323 } 324 } 325 // string "f" 326 o = append(o, 0xa1, 0x66) 327 if z.Final == nil { 328 o = msgp.AppendNil(o) 329 } else { 330 o, err = z.Final.MarshalMsg(o) 331 if err != nil { 332 err = msgp.WrapError(err, "Final") 333 return 334 } 335 } 336 return 337 } 338 339 // UnmarshalMsg implements msgp.Unmarshaler 340 func (z *nsScannerResp) UnmarshalMsg(bts []byte) (o []byte, err error) { 341 var field []byte 342 _ = field 343 var zb0001 uint32 344 zb0001, bts, err = msgp.ReadMapHeaderBytes(bts) 345 if err != nil { 346 err = msgp.WrapError(err) 347 return 348 } 349 for zb0001 > 0 { 350 zb0001-- 351 field, bts, err = msgp.ReadMapKeyZC(bts) 352 if err != nil { 353 err = msgp.WrapError(err) 354 return 355 } 356 switch msgp.UnsafeString(field) { 357 case "u": 358 if msgp.IsNil(bts) { 359 bts, err = msgp.ReadNilBytes(bts) 360 if err != nil { 361 return 362 } 363 z.Update = nil 364 } else { 365 if z.Update == nil { 366 z.Update = new(dataUsageEntry) 367 } 368 bts, err = z.Update.UnmarshalMsg(bts) 369 if err != nil { 370 err = msgp.WrapError(err, "Update") 371 return 372 } 373 } 374 case "f": 375 if msgp.IsNil(bts) { 376 bts, err = msgp.ReadNilBytes(bts) 377 if err != nil { 378 return 379 } 380 z.Final = nil 381 } else { 382 if z.Final == nil { 383 z.Final = new(dataUsageCache) 384 } 385 bts, err = z.Final.UnmarshalMsg(bts) 386 if err != nil { 387 err = msgp.WrapError(err, "Final") 388 return 389 } 390 } 391 default: 392 bts, err = msgp.Skip(bts) 393 if err != nil { 394 err = msgp.WrapError(err) 395 return 396 } 397 } 398 } 399 o = bts 400 return 401 } 402 403 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 404 func (z *nsScannerResp) Msgsize() (s int) { 405 s = 1 + 2 406 if z.Update == nil { 407 s += msgp.NilSize 408 } else { 409 s += z.Update.Msgsize() 410 } 411 s += 2 412 if z.Final == nil { 413 s += msgp.NilSize 414 } else { 415 s += z.Final.Msgsize() 416 } 417 return 418 }