NewObject creates a new remote union file object
(ctx context.Context, remote string)
| 777 | |
| 778 | // NewObject creates a new remote union file object |
| 779 | func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) { |
| 780 | objs := make([]*upstream.Object, len(f.upstreams)) |
| 781 | errs := Errors(make([]error, len(f.upstreams))) |
| 782 | multithread(len(f.upstreams), func(i int) { |
| 783 | u := f.upstreams[i] |
| 784 | o, err := u.NewObject(ctx, remote) |
| 785 | if err != nil && err != fs.ErrorObjectNotFound { |
| 786 | errs[i] = fmt.Errorf("%s: %w", u.Name(), err) |
| 787 | return |
| 788 | } |
| 789 | objs[i] = u.WrapObject(o) |
| 790 | }) |
| 791 | var entries []upstream.Entry |
| 792 | for _, o := range objs { |
| 793 | if o != nil { |
| 794 | entries = append(entries, o) |
| 795 | } |
| 796 | } |
| 797 | if len(entries) == 0 { |
| 798 | return nil, fs.ErrorObjectNotFound |
| 799 | } |
| 800 | e, err := f.wrapEntries(entries...) |
| 801 | if err != nil { |
| 802 | return nil, err |
| 803 | } |
| 804 | return e.(*Object), errs.Err() |
| 805 | } |
| 806 | |
| 807 | // Precision is the greatest Precision of all upstreams |
| 808 | func (f *Fs) Precision() time.Duration { |