1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
10
// RemoveAll is a default implementation for StorageWriter.RemoveAll.
11
// Providers may have more efficient implementations, or better error handling,
12
// or safeguards against races with other users of the same storage medium.
13
// But a simple way to implement RemoveAll would be to delegate to here.
14
func RemoveAll(stor Storage) error {
15
files, err := stor.List("")
17
return fmt.Errorf("unable to list files for deletion: %v", err)
20
// Some limited parallellism might be useful in this loop.
21
for _, file := range files {
22
err = stor.Remove(file)