// packMetadata composes the provided data into the format required
// by the GCE API.
513943
func packMetadata(data map[string]string) *compute.Metadata {
	var items []*compute.MetadataItems
	for key, value := range data {
		// Needs to be a new variable so that &localValue is different
		// each time round the loop.
		localValue := value
		item := compute.MetadataItems{
			Key:   key,
			Value: &localValue,
		}
		items = append(items, &item)
	}
	return &compute.Metadata{Items: items}
}
110879
func (m *GpsInjectData) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)
	binary.Write(data, binary.LittleEndian, m.LEN)
	binary.Write(data, binary.LittleEndian, m.DATA)
	return data.Bytes()
}
209889
func (s *fs) GetMetadata(dgst digest.Digest, key string) ([]byte, error) {
	s.RLock()
	defer s.RUnlock()

	if _, err := s.get(dgst); err != nil {
		return nil, err
	}
	bytes, err := ioutil.ReadFile(filepath.Join(s.metadataDir(dgst), key))
	if err != nil {
		return nil, errors.Wrap(err, "failed to read metadata")
	}
	return bytes, nil
}
598223
func (s *InitiateDocumentVersionUploadOutput) SetUploadMetadata(v *UploadMetadata) *InitiateDocumentVersionUploadOutput {
	s.UploadMetadata = v
	return s
}
1214989
func validateMetadata(meta map[string]string) error {
	if len(meta) > metaMaxKeyPairs {
		return fmt.Errorf("metadata cannot contain more than %d key/value pairs", metaMaxKeyPairs)
	}

	for key, value := range meta {
		if err := validateMetaPair(key, value); err != nil {
			return errwrap.Wrapf(fmt.Sprintf("failed to load metadata pair (%q, %q): {{err}}", key, value), err)
		}
	}

	return nil
}
314776
func (s *GetTemplateSummaryOutput) SetMetadata(v string) *GetTemplateSummaryOutput {
	s.Metadata = &v
	return s
}
1008280
func (s *ConnectivityInfo) SetMetadata(v string) *ConnectivityInfo {
	s.Metadata = &v
	return s
}
857052
func (m *TerrainData) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.LAT)
	binary.Write(data, binary.LittleEndian, m.LON)
	binary.Write(data, binary.LittleEndian, m.GRID_SPACING)
	binary.Write(data, binary.LittleEndian, m.DATA)
	binary.Write(data, binary.LittleEndian, m.GRIDBIT)
	return data.Bytes()
}
721931
func (m *Statustext) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.SEVERITY)
	binary.Write(data, binary.LittleEndian, m.TEXT)
	return data.Bytes()
}
770223
func (m *ParamValue) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.PARAM_VALUE)
	binary.Write(data, binary.LittleEndian, m.PARAM_COUNT)
	binary.Write(data, binary.LittleEndian, m.PARAM_INDEX)
	binary.Write(data, binary.LittleEndian, m.PARAM_ID)
	binary.Write(data, binary.LittleEndian, m.PARAM_TYPE)
	return data.Bytes()
}
655722
func parseMetadata(md map[string]string) map[string]interface{} {
	m := make(map[string]interface{}, len(md))
	for key, value := range md {
		m[key] = value
	}
	return m
}
198318
func (s *fs) SetMetadata(dgst digest.Digest, key string, data []byte) error {
	s.Lock()
	defer s.Unlock()
	if _, err := s.get(dgst); err != nil {
		return err
	}

	baseDir := filepath.Join(s.metadataDir(dgst))
	if err := os.MkdirAll(baseDir, 0700); err != nil {
		return err
	}
	return ioutils.AtomicWriteFile(filepath.Join(s.metadataDir(dgst), key), data, 0600)
}
1188777
func (i *InstallationPermissions) GetMetadata() string {
	if i == nil || i.Metadata == nil {
		return ""
	}
	return *i.Metadata
}
1278382
func (m *RequestDataStream) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.REQ_MESSAGE_RATE)
	binary.Write(data, binary.LittleEndian, m.TARGET_SYSTEM)
	binary.Write(data, binary.LittleEndian, m.TARGET_COMPONENT)
	binary.Write(data, binary.LittleEndian, m.REQ_STREAM_ID)
	binary.Write(data, binary.LittleEndian, m.START_STOP)
	return data.Bytes()
}
467927
func (m *TerrainReport) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.LAT)
	binary.Write(data, binary.LittleEndian, m.LON)
	binary.Write(data, binary.LittleEndian, m.TERRAIN_HEIGHT)
	binary.Write(data, binary.LittleEndian, m.CURRENT_HEIGHT)
	binary.Write(data, binary.LittleEndian, m.SPACING)
	binary.Write(data, binary.LittleEndian, m.PENDING)
	binary.Write(data, binary.LittleEndian, m.LOADED)
	return data.Bytes()
}
14622
func (b *BaggedModel) GetMetadata() base.ClassifierMetadataV1 {

	return base.ClassifierMetadataV1{
		FormatVersion:      1,
		ClassifierName:     "BaggedModel",
		ClassifierVersion:  "1.0",
		ClassifierMetadata: nil,
	}

}
1213102
func docAsMetadata(doc *storageMetaDoc) *Metadata {
	meta := NewMetadata()
	meta.Started = metadocUnixToTime(doc.Started)
	meta.Notes = doc.Notes

	meta.Origin.Model = doc.Model
	meta.Origin.Machine = doc.Machine
	meta.Origin.Hostname = doc.Hostname
	meta.Origin.Version = doc.Version
	meta.Origin.Series = doc.Series

	meta.SetID(doc.ID)

	if doc.Finished != 0 {
		finished := metadocUnixToTime(doc.Finished)
		meta.Finished = &finished
	}

	if doc.isFileInfoComplete() {
		// Set the file-related fields.

		// The doc should have already been validated when stored.
		meta.FileMetadata.Raw.Size = doc.Size
		meta.FileMetadata.Raw.Checksum = doc.Checksum
		meta.FileMetadata.Raw.ChecksumFormat = doc.ChecksumFormat
	}

	if doc.Stored != 0 {
		stored := metadocUnixToTime(doc.Stored)
		meta.SetStored(&stored)
	}

	return meta
}