Run ls in parallel so can parallelise the slow ModTime operations

This commit is contained in:
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 Todo
* FIXME: More -dry-run checks for object transfer * 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 * Check logging in various parts
* Make logging controllable with flags (mostly done) * Make logging controllable with flags (mostly done)
* progress meter would be nice! Do this by wrapping the Reader with a progress bar * 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 // List the Fs to stdout
//
// Lists in parallel which may get them out of order
func List(f Fs) { func List(f Fs) {
// FIXME error?
in := f.List() in := f.List()
for fs := range in { var wg sync.WaitGroup
// FIXME wg.Add(*checkers)
// if object.PseudoDirectory { for i := 0; i < *checkers; i++ {
// fmt.Printf("%9s %19s %s\n", "Directory", "-", fs.Remote()) go func() {
// } else { defer wg.Done()
// FIXME ModTime is expensive? for fs := range in {
modTime := fs.ModTime() 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(), 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()) }
// } }()
} }
wg.Wait()
} }
// Lists files in a container // Lists files in a container