|
|
|
@ -30,35 +30,54 @@ func (z *dataUsageCache) DecodeMsg(dc *msgp.Reader) (err error) { |
|
|
|
|
err = msgp.WrapError(err, "Info") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
case "Cache": |
|
|
|
|
case "Disks": |
|
|
|
|
var zb0002 uint32 |
|
|
|
|
zb0002, err = dc.ReadMapHeader() |
|
|
|
|
zb0002, err = dc.ReadArrayHeader() |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Disks") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if cap(z.Disks) >= int(zb0002) { |
|
|
|
|
z.Disks = (z.Disks)[:zb0002] |
|
|
|
|
} else { |
|
|
|
|
z.Disks = make([]string, zb0002) |
|
|
|
|
} |
|
|
|
|
for za0001 := range z.Disks { |
|
|
|
|
z.Disks[za0001], err = dc.ReadString() |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Disks", za0001) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
case "Cache": |
|
|
|
|
var zb0003 uint32 |
|
|
|
|
zb0003, err = dc.ReadMapHeader() |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if z.Cache == nil { |
|
|
|
|
z.Cache = make(map[string]dataUsageEntry, zb0002) |
|
|
|
|
z.Cache = make(map[string]dataUsageEntry, zb0003) |
|
|
|
|
} else if len(z.Cache) > 0 { |
|
|
|
|
for key := range z.Cache { |
|
|
|
|
delete(z.Cache, key) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for zb0002 > 0 { |
|
|
|
|
zb0002-- |
|
|
|
|
var za0001 string |
|
|
|
|
var za0002 dataUsageEntry |
|
|
|
|
za0001, err = dc.ReadString() |
|
|
|
|
for zb0003 > 0 { |
|
|
|
|
zb0003-- |
|
|
|
|
var za0002 string |
|
|
|
|
var za0003 dataUsageEntry |
|
|
|
|
za0002, err = dc.ReadString() |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
err = za0002.DecodeMsg(dc) |
|
|
|
|
err = za0003.DecodeMsg(dc) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0001) |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0002) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
z.Cache[za0001] = za0002 |
|
|
|
|
z.Cache[za0002] = za0003 |
|
|
|
|
} |
|
|
|
|
default: |
|
|
|
|
err = dc.Skip() |
|
|
|
@ -73,9 +92,9 @@ func (z *dataUsageCache) DecodeMsg(dc *msgp.Reader) (err error) { |
|
|
|
|
|
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
|
|
|
func (z *dataUsageCache) EncodeMsg(en *msgp.Writer) (err error) { |
|
|
|
|
// map header, size 2
|
|
|
|
|
// map header, size 3
|
|
|
|
|
// write "Info"
|
|
|
|
|
err = en.Append(0x82, 0xa4, 0x49, 0x6e, 0x66, 0x6f) |
|
|
|
|
err = en.Append(0x83, 0xa4, 0x49, 0x6e, 0x66, 0x6f) |
|
|
|
|
if err != nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -84,6 +103,23 @@ func (z *dataUsageCache) EncodeMsg(en *msgp.Writer) (err error) { |
|
|
|
|
err = msgp.WrapError(err, "Info") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
// write "Disks"
|
|
|
|
|
err = en.Append(0xa5, 0x44, 0x69, 0x73, 0x6b, 0x73) |
|
|
|
|
if err != nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
err = en.WriteArrayHeader(uint32(len(z.Disks))) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Disks") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
for za0001 := range z.Disks { |
|
|
|
|
err = en.WriteString(z.Disks[za0001]) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Disks", za0001) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// write "Cache"
|
|
|
|
|
err = en.Append(0xa5, 0x43, 0x61, 0x63, 0x68, 0x65) |
|
|
|
|
if err != nil { |
|
|
|
@ -94,15 +130,15 @@ func (z *dataUsageCache) EncodeMsg(en *msgp.Writer) (err error) { |
|
|
|
|
err = msgp.WrapError(err, "Cache") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
for za0001, za0002 := range z.Cache { |
|
|
|
|
err = en.WriteString(za0001) |
|
|
|
|
for za0002, za0003 := range z.Cache { |
|
|
|
|
err = en.WriteString(za0002) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
err = za0002.EncodeMsg(en) |
|
|
|
|
err = za0003.EncodeMsg(en) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0001) |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0002) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -112,22 +148,28 @@ func (z *dataUsageCache) EncodeMsg(en *msgp.Writer) (err error) { |
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
|
|
|
func (z *dataUsageCache) MarshalMsg(b []byte) (o []byte, err error) { |
|
|
|
|
o = msgp.Require(b, z.Msgsize()) |
|
|
|
|
// map header, size 2
|
|
|
|
|
// map header, size 3
|
|
|
|
|
// string "Info"
|
|
|
|
|
o = append(o, 0x82, 0xa4, 0x49, 0x6e, 0x66, 0x6f) |
|
|
|
|
o = append(o, 0x83, 0xa4, 0x49, 0x6e, 0x66, 0x6f) |
|
|
|
|
o, err = z.Info.MarshalMsg(o) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Info") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
// string "Disks"
|
|
|
|
|
o = append(o, 0xa5, 0x44, 0x69, 0x73, 0x6b, 0x73) |
|
|
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.Disks))) |
|
|
|
|
for za0001 := range z.Disks { |
|
|
|
|
o = msgp.AppendString(o, z.Disks[za0001]) |
|
|
|
|
} |
|
|
|
|
// string "Cache"
|
|
|
|
|
o = append(o, 0xa5, 0x43, 0x61, 0x63, 0x68, 0x65) |
|
|
|
|
o = msgp.AppendMapHeader(o, uint32(len(z.Cache))) |
|
|
|
|
for za0001, za0002 := range z.Cache { |
|
|
|
|
o = msgp.AppendString(o, za0001) |
|
|
|
|
o, err = za0002.MarshalMsg(o) |
|
|
|
|
for za0002, za0003 := range z.Cache { |
|
|
|
|
o = msgp.AppendString(o, za0002) |
|
|
|
|
o, err = za0003.MarshalMsg(o) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0001) |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0002) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -158,35 +200,54 @@ func (z *dataUsageCache) UnmarshalMsg(bts []byte) (o []byte, err error) { |
|
|
|
|
err = msgp.WrapError(err, "Info") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
case "Cache": |
|
|
|
|
case "Disks": |
|
|
|
|
var zb0002 uint32 |
|
|
|
|
zb0002, bts, err = msgp.ReadMapHeaderBytes(bts) |
|
|
|
|
zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Disks") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if cap(z.Disks) >= int(zb0002) { |
|
|
|
|
z.Disks = (z.Disks)[:zb0002] |
|
|
|
|
} else { |
|
|
|
|
z.Disks = make([]string, zb0002) |
|
|
|
|
} |
|
|
|
|
for za0001 := range z.Disks { |
|
|
|
|
z.Disks[za0001], bts, err = msgp.ReadStringBytes(bts) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Disks", za0001) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
case "Cache": |
|
|
|
|
var zb0003 uint32 |
|
|
|
|
zb0003, bts, err = msgp.ReadMapHeaderBytes(bts) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if z.Cache == nil { |
|
|
|
|
z.Cache = make(map[string]dataUsageEntry, zb0002) |
|
|
|
|
z.Cache = make(map[string]dataUsageEntry, zb0003) |
|
|
|
|
} else if len(z.Cache) > 0 { |
|
|
|
|
for key := range z.Cache { |
|
|
|
|
delete(z.Cache, key) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for zb0002 > 0 { |
|
|
|
|
var za0001 string |
|
|
|
|
var za0002 dataUsageEntry |
|
|
|
|
zb0002-- |
|
|
|
|
za0001, bts, err = msgp.ReadStringBytes(bts) |
|
|
|
|
for zb0003 > 0 { |
|
|
|
|
var za0002 string |
|
|
|
|
var za0003 dataUsageEntry |
|
|
|
|
zb0003-- |
|
|
|
|
za0002, bts, err = msgp.ReadStringBytes(bts) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
bts, err = za0002.UnmarshalMsg(bts) |
|
|
|
|
bts, err = za0003.UnmarshalMsg(bts) |
|
|
|
|
if err != nil { |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0001) |
|
|
|
|
err = msgp.WrapError(err, "Cache", za0002) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
z.Cache[za0001] = za0002 |
|
|
|
|
z.Cache[za0002] = za0003 |
|
|
|
|
} |
|
|
|
|
default: |
|
|
|
|
bts, err = msgp.Skip(bts) |
|
|
|
@ -202,11 +263,15 @@ func (z *dataUsageCache) UnmarshalMsg(bts []byte) (o []byte, err error) { |
|
|
|
|
|
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
|
|
|
func (z *dataUsageCache) Msgsize() (s int) { |
|
|
|
|
s = 1 + 5 + z.Info.Msgsize() + 6 + msgp.MapHeaderSize |
|
|
|
|
s = 1 + 5 + z.Info.Msgsize() + 6 + msgp.ArrayHeaderSize |
|
|
|
|
for za0001 := range z.Disks { |
|
|
|
|
s += msgp.StringPrefixSize + len(z.Disks[za0001]) |
|
|
|
|
} |
|
|
|
|
s += 6 + msgp.MapHeaderSize |
|
|
|
|
if z.Cache != nil { |
|
|
|
|
for za0001, za0002 := range z.Cache { |
|
|
|
|
_ = za0002 |
|
|
|
|
s += msgp.StringPrefixSize + len(za0001) + za0002.Msgsize() |
|
|
|
|
for za0002, za0003 := range z.Cache { |
|
|
|
|
_ = za0003 |
|
|
|
|
s += msgp.StringPrefixSize + len(za0002) + za0003.Msgsize() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|