Implement cleanup command for emptying trash / removing old versions of files
This commit is contained in:
@@ -273,6 +273,15 @@ type PutUncheckeder interface {
|
||||
PutUnchecked(in io.Reader, src ObjectInfo) (Object, error)
|
||||
}
|
||||
|
||||
// CleanUpper is an optional interfaces for Fs
|
||||
type CleanUpper interface {
|
||||
// CleanUp the trash in the Fs
|
||||
//
|
||||
// Implement this if you have a way of emptying the trash or
|
||||
// otherwise cleaning up old versions of files.
|
||||
CleanUp() error
|
||||
}
|
||||
|
||||
// ObjectsChan is a channel of Objects
|
||||
type ObjectsChan chan Object
|
||||
|
||||
|
||||
@@ -1379,3 +1379,12 @@ func listToChan(list *Lister) ObjectsChan {
|
||||
}()
|
||||
return o
|
||||
}
|
||||
|
||||
// CleanUp removes the trash for the Fs
|
||||
func CleanUp(f Fs) error {
|
||||
fc, ok := f.(CleanUpper)
|
||||
if !ok {
|
||||
return errors.Errorf("%v doesn't support cleanup", f)
|
||||
}
|
||||
return fc.CleanUp()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user