mirror of
https://github.com/rclone/rclone.git
synced 2025-12-31 23:53:18 +00:00
Use swift.ObjectsWalk
This commit is contained in:
20
fs_swift.go
20
fs_swift.go
@@ -57,23 +57,21 @@ func (f *FsSwift) NewFsObject(remote string) FsObject {
|
||||
}
|
||||
|
||||
// Walk the path returning a channel of FsObjects
|
||||
//
|
||||
// FIXME ignore symlinks?
|
||||
// FIXME what about hardlinks / etc
|
||||
//
|
||||
// FIXME not returning error if dir not found?
|
||||
func (f *FsSwift) List() FsObjectsChan {
|
||||
out := make(FsObjectsChan, *checkers)
|
||||
go func() {
|
||||
// FIXME use a smaller limit?
|
||||
err := f.c.ObjectsAllFn(f.container, nil, func(objects []swift.Object) bool {
|
||||
for i := range objects {
|
||||
object := &objects[i]
|
||||
if fs := f.NewFsObjectWithInfo(object.Name, object); fs != nil {
|
||||
out <- fs
|
||||
err := f.c.ObjectsWalk(f.container, nil, func(opts *swift.ObjectsOpts) (interface{}, error) {
|
||||
objects, err := f.c.Objects(f.container, opts)
|
||||
if err == nil {
|
||||
for i := range objects {
|
||||
object := &objects[i]
|
||||
if fs := f.NewFsObjectWithInfo(object.Name, object); fs != nil {
|
||||
out <- fs
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
return objects, err
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("Couldn't read container %q: %s", f.container, err)
|
||||
|
||||
Reference in New Issue
Block a user