Beispiel #1
0
// UpdateFromMetadata updates the result with the information in the
// metadata value.
func (r *BackupsMetadataResult) UpdateFromMetadata(meta *metadata.Metadata) {
	r.ID = meta.ID()
	r.Started = meta.Started()
	if meta.Finished() != nil {
		r.Finished = *(meta.Finished())
	}
	r.Checksum = meta.Checksum()
	r.ChecksumFormat = meta.ChecksumFormat()
	r.Size = meta.Size()
	r.Stored = meta.Stored()
	r.Notes = meta.Notes()

	origin := meta.Origin()
	r.Environment = origin.Environment()
	r.Machine = origin.Machine()
	r.Hostname = origin.Hostname()
	r.Version = origin.Version()
}
Beispiel #2
0
// updateFromMetadata copies the corresponding data from the backup
// Metadata into the backupMetadataDoc.
func (doc *backupMetadataDoc) updateFromMetadata(metadata *metadata.Metadata) {
	finished := metadata.Finished()
	// Ignore metadata.ID.
	doc.Started = metadata.Started().Unix()
	if finished != nil {
		doc.Finished = finished.Unix()
	}
	doc.Checksum = metadata.Checksum()
	doc.ChecksumFormat = metadata.ChecksumFormat()
	doc.Size = metadata.Size()
	doc.Stored = metadata.Stored()
	doc.Notes = metadata.Notes()

	origin := metadata.Origin()
	doc.Environment = origin.Environment()
	doc.Machine = origin.Machine()
	doc.Hostname = origin.Hostname()
	doc.Version = origin.Version()
}