示例#1
0
文件: mock.go 项目: raphaelm/backupd
func (s *mockStore) DeleteBackup(backup *model.Backup) (deleted bool, err error) {
	if _, ok := s.backups[backup.ID]; ok {
		delete(s.backups, backup.ID)
		deleted = true
	}
	backup.ID = 0
	return deleted, nil
}
示例#2
0
文件: mock.go 项目: raphaelm/backupd
func (s *mockStore) SaveBackup(backup *model.Backup) (created bool, err error) {
	if _, ok := s.jobs[backup.JobID]; !ok {
		return false, errors.New("Job not found")
	}
	if backup.ID == 0 {
		s.idCounter++
		backup.ID = s.idCounter
		created = true
	}
	s.backups[backup.ID] = *backup
	return created, nil
}