Exemple #1
0
func repairDatabase(store *storage.Storage, pretend, force bool, fingerprintAlgorithm string) error {
	log.Infof(2, "retrieving all files from the database.")

	files, err := store.Files()
	if err != nil {
		return fmt.Errorf("could not retrieve paths from storage: %v", err)
	}

	paths := make([]string, len(files))
	for index := 0; index < len(files); index++ {
		paths[index] = files[index].Path()
	}

	err = repairFiles(store, paths, pretend, force, fingerprintAlgorithm)
	if err != nil {
		return err
	}

	return nil
}
Exemple #2
0
func (command RepairCommand) repairDatabase(store *storage.Storage) error {
	if command.verbose {
		log.Info("retrieving all files from the database.")
	}

	files, err := store.Files()
	if err != nil {
		return fmt.Errorf("could not retrieve paths from storage: %v", err)
	}

	paths := make([]string, len(files))
	for index := 0; index < len(files); index++ {
		paths[index] = files[index].Path()
	}

	err = command.checkFiles(store, paths)
	if err != nil {
		return err
	}

	return nil
}