mirror of
https://github.com/rclone/rclone
synced 2024-12-22 13:03:02 +01:00
Use swift.ObjectsWalk
This commit is contained in:
parent
555e545b46
commit
4028a4192f
@ -51,10 +51,9 @@ func (f *FsLocal) NewFsObject(remote string) FsObject {
|
|||||||
return f.NewFsObjectWithInfo(remote, nil)
|
return f.NewFsObjectWithInfo(remote, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk the path returning a channel of FsObjects
|
// List the path returning a channel of FsObjects
|
||||||
//
|
//
|
||||||
// FIXME ignore symlinks?
|
// Ignores everything which isn't Storable, eg links etc
|
||||||
// FIXME what about hardlinks / etc
|
|
||||||
func (f *FsLocal) List() FsObjectsChan {
|
func (f *FsLocal) List() FsObjectsChan {
|
||||||
out := make(FsObjectsChan, *checkers)
|
out := make(FsObjectsChan, *checkers)
|
||||||
go func() {
|
go func() {
|
||||||
|
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
|
// 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 {
|
func (f *FsSwift) List() FsObjectsChan {
|
||||||
out := make(FsObjectsChan, *checkers)
|
out := make(FsObjectsChan, *checkers)
|
||||||
go func() {
|
go func() {
|
||||||
// FIXME use a smaller limit?
|
// FIXME use a smaller limit?
|
||||||
err := f.c.ObjectsAllFn(f.container, nil, func(objects []swift.Object) bool {
|
err := f.c.ObjectsWalk(f.container, nil, func(opts *swift.ObjectsOpts) (interface{}, error) {
|
||||||
for i := range objects {
|
objects, err := f.c.Objects(f.container, opts)
|
||||||
object := &objects[i]
|
if err == nil {
|
||||||
if fs := f.NewFsObjectWithInfo(object.Name, object); fs != nil {
|
for i := range objects {
|
||||||
out <- fs
|
object := &objects[i]
|
||||||
|
if fs := f.NewFsObjectWithInfo(object.Name, object); fs != nil {
|
||||||
|
out <- fs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return objects, err
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Couldn't read container %q: %s", f.container, err)
|
log.Printf("Couldn't read container %q: %s", f.container, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user