Пример #1
0
func printMetadata(metadata bakapy.Metadata) {
	fmt.Printf("==> [%s]%s\n", metadata.JobName, metadata.TaskId)
	fmt.Println("==> Success:", metadata.Success)
	fmt.Println("==> Command:", metadata.Command)
	fmt.Println("==> AvgSpeed:", metadata.AvgSpeed())
	fmt.Println("==> PID:", metadata.Pid)
	fmt.Println("==> Start:", metadata.StartTime)
	fmt.Println("==> End:", metadata.EndTime)
	fmt.Println("==> Duration:", metadata.Duration())
	fmt.Println("==> Files:", metadata.Files)
	fmt.Println("==> Size:", metadata.TotalSize)
	fmt.Println("==> Expire:", metadata.ExpireTime)
	fmt.Printf("==> Output:\n%s\n", string(metadata.Output))
	fmt.Printf("==> Errput:\n%s\n", string(metadata.Errput))
	fmt.Println("==================================")
}
Пример #2
0
func (mm *TestMetaMan) Add(id bakapy.TaskId, md bakapy.Metadata) error {
	md.TaskId = id
	if mm.addErr == nil {
		mm.stor[id] = md
		return nil
	}
	return mm.addErr
}
Пример #3
0
func (m *JSONDir) Add(id bakapy.TaskId, md bakapy.Metadata) error {
	m.logger.Debug("adding metadata for task id %s", id)
	m.lockId(id)
	md.TaskId = id
	if _, err := m.View(id); err == nil {
		return fmt.Errorf("metadata for task %s already exist", id)
	}
	return m.Save(id, &md)
}