mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
local: delete backend implementation of Purge to speed up and make stats
In this commit (2014 for v1.02) Purge was implemented for the local
backend:
1527e64ee7
local: Implement Purger interface
This appeared to be implemented just to make a Purge and doesn't
appear to do anything useful.
It is in fact significatly worse than the rclone fallback purge since
it doesn't operate in parallel or update stats.
This patch removes the Purge routine for a consequent speed up and
showing of stats.
See: https://forum.rclone.org/t/progress-flag-for-rclone-purge/44416
This commit is contained in:
parent
4a049c12fe
commit
6ff1b6c505
|
@ -793,27 +793,6 @@ func (f *Fs) readPrecision() (precision time.Duration) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purge deletes all the files in the directory
|
|
||||||
//
|
|
||||||
// Optional interface: Only implement this if you have a way of
|
|
||||||
// deleting all the files quicker than just running Remove() on the
|
|
||||||
// result of List()
|
|
||||||
func (f *Fs) Purge(ctx context.Context, dir string) error {
|
|
||||||
dir = f.localPath(dir)
|
|
||||||
fi, err := f.lstat(dir)
|
|
||||||
if err != nil {
|
|
||||||
// already purged
|
|
||||||
if os.IsNotExist(err) {
|
|
||||||
return fs.ErrorDirNotFound
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !fi.Mode().IsDir() {
|
|
||||||
return fmt.Errorf("can't purge non directory: %q", dir)
|
|
||||||
}
|
|
||||||
return os.RemoveAll(dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move src to this remote using server-side move operations.
|
// Move src to this remote using server-side move operations.
|
||||||
//
|
//
|
||||||
// This is stored with the remote path given.
|
// This is stored with the remote path given.
|
||||||
|
@ -1571,7 +1550,6 @@ func (d *Directory) Hash() {
|
||||||
// Check the interfaces are satisfied
|
// Check the interfaces are satisfied
|
||||||
var (
|
var (
|
||||||
_ fs.Fs = &Fs{}
|
_ fs.Fs = &Fs{}
|
||||||
_ fs.Purger = &Fs{}
|
|
||||||
_ fs.PutStreamer = &Fs{}
|
_ fs.PutStreamer = &Fs{}
|
||||||
_ fs.Mover = &Fs{}
|
_ fs.Mover = &Fs{}
|
||||||
_ fs.DirMover = &Fs{}
|
_ fs.DirMover = &Fs{}
|
||||||
|
|
|
@ -527,7 +527,7 @@ upon backend-specific capabilities.
|
||||||
| WebDAV | Yes | Yes | Yes | Yes | No | No | Yes ³ | No | No | Yes | Yes |
|
| WebDAV | Yes | Yes | Yes | Yes | No | No | Yes ³ | No | No | Yes | Yes |
|
||||||
| Yandex Disk | Yes | Yes | Yes | Yes | Yes | No | Yes | No | Yes | Yes | Yes |
|
| Yandex Disk | Yes | Yes | Yes | Yes | Yes | No | Yes | No | Yes | Yes | Yes |
|
||||||
| Zoho WorkDrive | Yes | Yes | Yes | Yes | No | No | No | No | No | Yes | Yes |
|
| Zoho WorkDrive | Yes | Yes | Yes | Yes | No | No | No | No | No | Yes | Yes |
|
||||||
| The local filesystem | Yes | No | Yes | Yes | No | No | Yes | Yes | No | Yes | Yes |
|
| The local filesystem | No | No | Yes | Yes | No | No | Yes | Yes | No | Yes | Yes |
|
||||||
|
|
||||||
¹ Note Swift implements this in order to delete directory markers but
|
¹ Note Swift implements this in order to delete directory markers but
|
||||||
it doesn't actually have a quicker way of deleting files other than
|
it doesn't actually have a quicker way of deleting files other than
|
||||||
|
|
Loading…
Reference in New Issue
Block a user