// Deserialize takes some Flatbuffer serialized bytes and deserialize's them
// as a structs.DiskStats.
187152
func Deserialize(p []byte) *structs.DiskStats {
	stts := &structs.DiskStats{}
	devF := &flat.Device{}
	statsFlat := flat.GetRootAsDiskStats(p, 0)
	stts.Timestamp = statsFlat.Timestamp()
	len := statsFlat.DeviceLength()
	stts.Device = make([]structs.Device, len)
	for i := 0; i < len; i++ {
		var dev structs.Device
		if statsFlat.Device(devF, i) {
			dev.Major = devF.Major()
			dev.Minor = devF.Minor()
			dev.Name = string(devF.Name())
			dev.ReadsCompleted = devF.ReadsCompleted()
			dev.ReadsMerged = devF.ReadsMerged()
			dev.ReadSectors = devF.ReadSectors()
			dev.ReadingTime = devF.ReadingTime()
			dev.WritesCompleted = devF.WritesCompleted()
			dev.WritesMerged = devF.WritesMerged()
			dev.WrittenSectors = devF.WrittenSectors()
			dev.WritingTime = devF.WritingTime()
			dev.IOInProgress = devF.IOInProgress()
			dev.IOTime = devF.IOTime()
			dev.WeightedIOTime = devF.WeightedIOTime()
		}
		stts.Device[i] = dev
	}
	return stts
}
568133
func Deserialize(p []byte) (*structs.DevUsage, error) {
	u := &structs.DevUsage{}
	err := json.Unmarshal(p, u)
	if err != nil {
		return nil, err
	}
	return u, nil
}
859919
func Deserialize(p []byte) (*info.CPUInfo, error) {
	inf := &info.CPUInfo{}
	err := json.Unmarshal(p, inf)
	if err != nil {
		return nil, err
	}
	return inf, nil
}
940013
func DeserializeMetadata(metadataBytes []byte) (map[string][]byte, error) {
	if metadataBytes == nil {
		return nil, nil
	}
	metadata := &kvrwset.KVMetadataWrite{}
	if err := proto.Unmarshal(metadataBytes, metadata); err != nil {
		return nil, err
	}
	m := make(map[string][]byte, len(metadata.Entries))
	for _, metadataEntry := range metadata.Entries {
		m[metadataEntry.Name] = metadataEntry.Value
	}
	return m, nil
}
1124082
func Deserialize(p []byte) u.Uptime {
	flatUp := structs.GetRootAsUptime(p, 0)
	var up u.Uptime
	up.Timestamp = flatUp.Timestamp()
	up.Total = flatUp.Total()
	up.Idle = flatUp.Idle()
	return up
}
204922
func Serialize(proc *procs.Processors) (p []byte, err error) {
	stdMu.Lock()
	defer stdMu.Unlock()
	if std == nil {
		std, err = NewProfiler()
		if err != nil {
			return nil, err
		}
	}
	return std.Serialize(proc)
}
324769
func Deserialize(p []byte) (*stats.CPUStats, error) {
	st := &stats.CPUStats{}
	err := json.Unmarshal(p, st)
	if err != nil {
		return nil, err
	}
	return st, nil
}
706503
func Serialize(data interface{}) (bytes []byte, err error) {
	switch data.(type) {
	case []byte:
		return data.([]byte), nil
	case string:
		return []byte(data.(string)), nil
	default:
		if data != nil {
			return []byte(fmt.Sprint(data)), nil
		}
	}
	return nil, nil
}
2536
func (s GobSerializer) Deserialize(d []byte, ss *sessions.Session) error {
	dec := gob.NewDecoder(bytes.NewBuffer(d))
	return dec.Decode(&ss.Values)
}
96297
func Deserialize(p []byte) *structs.DevUsage {
	uFlat := flat.GetRootAsDevUsage(p, 0)
	// get the # of interfaces
	iLen := uFlat.DeviceLength()
	u := &structs.DevUsage{
		Timestamp:  uFlat.Timestamp(),
		TimeDelta:  uFlat.TimeDelta(),
		Device: make([]structs.Device, iLen),
	}
	fDev := &flat.Device{}
	sDev := structs.Device{}
	for i := 0; i < iLen; i++ {
		if uFlat.Device(fDev, i) {
			sDev.Name = string(fDev.Name())
			sDev.RBytes = fDev.RBytes()
			sDev.RPackets = fDev.RPackets()
			sDev.RErrs = fDev.RErrs()
			sDev.RDrop = fDev.RDrop()
			sDev.RFIFO = fDev.RFIFO()
			sDev.RFrame = fDev.RFrame()
			sDev.RCompressed = fDev.RCompressed()
			sDev.RMulticast = fDev.RMulticast()
			sDev.TBytes = fDev.TBytes()
			sDev.TPackets = fDev.TPackets()
			sDev.TErrs = fDev.TErrs()
			sDev.TDrop = fDev.TDrop()
			sDev.TFIFO = fDev.TFIFO()
			sDev.TColls = fDev.TColls()
			sDev.TCarrier = fDev.TCarrier()
			sDev.TCompressed = fDev.TCompressed()
		}
		u.Device[i] = sDev
	}
	return u
}
124365
func Deserialize(p []byte) *mem.Info {
	infoFlat := structs.GetRootAsInfo(p, 0)
	info := &mem.Info{}
	info.Timestamp = infoFlat.Timestamp()
	info.Active = infoFlat.Active()
	info.ActiveAnon = infoFlat.ActiveAnon()
	info.ActiveFile = infoFlat.ActiveFile()
	info.AnonHugePages = infoFlat.AnonHugePages()
	info.AnonPages = infoFlat.AnonPages()
	info.Bounce = infoFlat.Bounce()
	info.Buffers = infoFlat.Buffers()
	info.Cached = infoFlat.Cached()
	info.CommitLimit = infoFlat.CommitLimit()
	info.CommittedAS = infoFlat.CommittedAS()
	info.DirectMap4K = infoFlat.DirectMap4K()
	info.DirectMap2M = infoFlat.DirectMap2M()
	info.Dirty = infoFlat.Dirty()
	info.HardwareCorrupted = infoFlat.HardwareCorrupted()
	info.HugePagesFree = infoFlat.HugePagesFree()
	info.HugePagesRsvd = infoFlat.HugePagesRsvd()
	info.HugePagesSize = infoFlat.HugePagesSize()
	info.HugePagesSurp = infoFlat.HugePagesSurp()
	info.HugePagesTotal = infoFlat.HugePagesTotal()
	info.Inactive = infoFlat.Inactive()
	info.InactiveAnon = infoFlat.InactiveAnon()
	info.InactiveFile = infoFlat.InactiveFile()
	info.KernelStack = infoFlat.KernelStack()
	info.Mapped = infoFlat.Mapped()
	info.MemAvailable = infoFlat.MemAvailable()
	info.MemFree = infoFlat.MemFree()
	info.MemTotal = infoFlat.MemTotal()
	info.Mlocked = infoFlat.Mlocked()
	info.NFSUnstable = infoFlat.NFSUnstable()
	info.PageTables = infoFlat.PageTables()
	info.Shmem = infoFlat.Shmem()
	info.Slab = infoFlat.Slab()
	info.SReclaimable = infoFlat.SReclaimable()
	info.SUnreclaim = infoFlat.SUnreclaim()
	info.SwapCached = infoFlat.SwapCached()
	info.SwapFree = infoFlat.SwapFree()
	info.SwapTotal = infoFlat.SwapTotal()
	info.Unevictable = infoFlat.Unevictable()
	info.VmallocChunk = infoFlat.VmallocChunk()
	info.VmallocTotal = infoFlat.VmallocTotal()
	info.VmallocUsed = infoFlat.VmallocUsed()
	info.Writeback = infoFlat.Writeback()
	info.WritebackTmp = infoFlat.WritebackTmp()
	return info
}
349703
func Serialize(key string, obj interface{}, options ...map[string]interface{}) ([]byte, error) {
	// only to the default serializer, check if no of the built'n serializer's key are registered, if not register them here
	// I don't put it to the initialize of the defaultSerializers because the developer may don't want the built'n serializers at all
	once.Do(func() {
		RegisterDefaults(defaultSerializers)
	})

	return defaultSerializers.Serialize(key, obj, options...)
}
141433
func Deserialize(p []byte) *processors.Processors {
	flatP := structs.GetRootAsProcessors(p, 0)
	procs := &processors.Processors{}
	flatCache := &structs.CacheInf{}
	procs.Timestamp = flatP.Timestamp()
	procs.Architecture = string(flatP.Architecture())
	procs.CPUs = flatP.CPUs()
	procs.Possible = string(flatP.Possible())
	procs.Present = string(flatP.Present())
	procs.Offline = string(flatP.Offline())
	procs.Online = string(flatP.Online())
	procs.Sockets = flatP.Sockets()
	procs.CoresPerSocket = flatP.CoresPerSocket()
	procs.ThreadsPerCore = flatP.ThreadsPerCore()
	procs.VendorID = string(flatP.VendorID())
	procs.CPUFamily = string(flatP.CPUFamily())
	procs.Model = string(flatP.Model())
	procs.ModelName = string(flatP.ModelName())
	procs.Stepping = string(flatP.Stepping())
	procs.Microcode = string(flatP.Microcode())
	procs.CPUMHz = flatP.CPUMHz()
	procs.MHzMin = flatP.MHzMin()
	procs.MHzMax = flatP.MHzMax()
	procs.BogoMIPS = flatP.BogoMIPS()
	procs.CacheSize = string(flatP.CacheSize())
	procs.CacheIDs = make([]string, 0, flatP.CacheLength())
	procs.Cache = make(map[string]string, flatP.CacheLength())
	for j := 0; j < flatP.CacheLength(); j++ {
		if !flatP.Cache(flatCache, j) {
			continue
		}
		procs.CacheIDs = append(procs.CacheIDs, string(flatCache.ID()))
		procs.Cache[procs.CacheIDs[j]] = string(flatCache.Size())
	}
	procs.Flags = make([]string, flatP.FlagsLength())
	for i := 0; i < len(procs.Flags); i++ {
		procs.Flags[i] = string(flatP.Flags(i))
	}
	procs.Bugs = make([]string, flatP.BugsLength())
	for i := 0; i < len(procs.Bugs); i++ {
		procs.Bugs[i] = string(flatP.Bugs(i))
	}
	procs.OpModes = make([]string, flatP.OpModesLength())
	for i := 0; i < len(procs.OpModes); i++ {
		procs.OpModes[i] = string(flatP.OpModes(i))
	}
	procs.Virtualization = string(flatP.Virtualization())
	procs.NumaNodes = flatP.NumaNodes()
	var n structs.Node
	procs.NumaNodeCPUs = make([]node.Node, flatP.NumaNodeCPUsLength())
	for i := 0; i < len(procs.NumaNodeCPUs); i++ {
		if !flatP.NumaNodeCPUs(&n, i) {
			continue
		}
		procs.NumaNodeCPUs[i].ID = n.ID()
		procs.NumaNodeCPUs[i].CPUList = string(n.CPUList())
	}
	return procs
}
55233
func Deserialize(p []byte) *m.MemInfo {
	infoFlat := structs.GetRootAsMemInfo(p, 0)
	info := &m.MemInfo{}
	info.Timestamp = infoFlat.Timestamp()
	info.TotalRAM = infoFlat.TotalRAM()
	info.FreeRAM = infoFlat.FreeRAM()
	info.SharedRAM = infoFlat.SharedRAM()
	info.BufferRAM = infoFlat.BufferRAM()
	info.TotalSwap = infoFlat.TotalSwap()
	info.FreeSwap = infoFlat.FreeSwap()
	return info
}
158865
func deserializeProperties(dst interface{}, props []datastore.Property) error {
	if k := reflect.Indirect(reflect.ValueOf(dst)).Type().Kind(); k != reflect.Struct {
		return fmt.Errorf("goon: Expected struct, got instead: %v", k)
	}
	if pls, ok := dst.(datastore.PropertyLoadSaver); ok {
		return pls.Load(props)
	}
	return datastore.LoadStruct(dst, props)
}
533789
func UnitSerialize(opts []*unit.UnitOption) io.Reader {
	var buf bytes.Buffer

	if len(opts) == 0 {
		return &buf
	}

	idx := map[string][]*unit.UnitOption{}
	for _, opt := range opts {
		idx[opt.Section] = append(idx[opt.Section], opt)
	}

	// CHANGED HERE: Output in the following order:
	// - Unit
	// - Service
	// - Install
	// rather than just iterating over the map in random order.
	for _, curSection := range []string{"Unit", "Service", "Install"} {
		curOpts, found := idx[curSection]
		if !found {
			continue
		}
		writeSectionHeader(&buf, curSection)
		writeNewline(&buf)

		for _, opt := range curOpts {
			writeOption(&buf, opt)
			writeNewline(&buf)
		}
		writeNewline(&buf)
	}

	return &buf
}
957163
func Deserialize(p []byte) (*structs.DevInfo, error) {
	info := &structs.DevInfo{}
	err := json.Unmarshal(p, info)
	if err != nil {
		return nil, err
	}
	return info, nil
}