Run ls in parallel so can parallelise the slow ModTime operations

s3-about
Nick Craig-Wood 2013-01-02 15:34:25 +00:00
parent ecb863dd4f
commit 12015b0007
2 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,8 @@
Todo
* FIXME: More -dry-run checks for object transfer
* FIXME ls is very slow also - need to run mtimes in parallel
* Ignoring the pseudo directories
* if object.PseudoDirectory {
* fmt.Printf("%9s %19s %s\n", "Directory", "-", fs.Remote())
* Check logging in various parts
* Make logging controllable with flags (mostly done)
* progress meter would be nice! Do this by wrapping the Reader with a progress bar

View File

@ -241,20 +241,22 @@ func Check(fdst, fsrc Fs) {
}
// List the Fs to stdout
//
// Lists in parallel which may get them out of order
func List(f Fs) {
// FIXME error?
in := f.List()
for fs := range in {
// FIXME
// if object.PseudoDirectory {
// fmt.Printf("%9s %19s %s\n", "Directory", "-", fs.Remote())
// } else {
// FIXME ModTime is expensive?
modTime := fs.ModTime()
fmt.Printf("%9d %19s %s\n", fs.Size(), modTime.Format("2006-01-02 15:04:05"), fs.Remote())
// fmt.Printf("%9d %19s %s\n", fs.Size(), object.LastModified.Format("2006-01-02 15:04:05"), fs.Remote())
// }
var wg sync.WaitGroup
wg.Add(*checkers)
for i := 0; i < *checkers; i++ {
go func() {
defer wg.Done()
for fs := range in {
modTime := fs.ModTime()
fmt.Printf("%9d %19s %s\n", fs.Size(), modTime.Format("2006-01-02 15:04:05"), fs.Remote())
}
}()
}
wg.Wait()
}
// Lists files in a container