------------------------------------------------------------ Implement ListRer is an optional interfaces for Fs ------------------------------------------------------------ * ListR lists the objects and directories of the Fs starting from dir recursively into out. dir should be "" to start from the
(ctx context.Context, dir string, callback fs.ListRCallback)
| 719 | of listing recursively that doing a directory traversal. |
| 720 | */ |
| 721 | func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (err error) { |
| 722 | bucketName, directory := f.split(dir) |
| 723 | list := list.NewHelper(callback) |
| 724 | listR := func(bucket, directory, prefix string, addBucket bool) error { |
| 725 | return f.list(ctx, bucket, directory, prefix, addBucket, true, 0, func(remote string, object *objectstorage.ObjectSummary, isDirectory bool) error { |
| 726 | entry, err := f.itemToDirEntry(ctx, remote, object, isDirectory) |
| 727 | if err != nil { |
| 728 | return err |
| 729 | } |
| 730 | return list.Add(entry) |
| 731 | }) |
| 732 | } |
| 733 | if bucketName == "" { |
| 734 | entries, err := f.listBuckets(ctx) |
| 735 | if err != nil { |
| 736 | return err |
| 737 | } |
| 738 | for _, entry := range entries { |
| 739 | err = list.Add(entry) |
| 740 | if err != nil { |
| 741 | return err |
| 742 | } |
| 743 | bucketName := entry.Remote() |
| 744 | err = listR(bucketName, "", f.rootDirectory, true) |
| 745 | if err != nil { |
| 746 | return err |
| 747 | } |
| 748 | // bucket must be present if listing succeeded |
| 749 | f.cache.MarkOK(bucketName) |
| 750 | } |
| 751 | } else { |
| 752 | err = listR(bucketName, directory, f.rootDirectory, f.rootBucket == "") |
| 753 | if err != nil { |
| 754 | return err |
| 755 | } |
| 756 | // bucket must be present if listing succeeded |
| 757 | f.cache.MarkOK(bucketName) |
| 758 | } |
| 759 | return list.Flush() |
| 760 | } |
| 761 | |
| 762 | // Metadata returns metadata for an object |
| 763 | // |
nothing calls this directly
no test coverage detected