MCPcopy
hub / github.com/rclone/rclone / NewObject

Method NewObject

backend/union/union.go:779–805  ·  view source on GitHub ↗

NewObject creates a new remote union file object

(ctx context.Context, remote string)

Source from the content-addressed store, hash-verified

777
778// NewObject creates a new remote union file object
779func (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
808func (f *Fs) Precision() time.Duration {

Callers 4

TestInternalReadOnlyMethod · 0.95
TestMoveCopyFunction · 0.95
PutMethod · 0.95
PutStreamMethod · 0.95

Calls 8

wrapEntriesMethod · 0.95
ErrorsTypeAlias · 0.85
multithreadFunction · 0.85
WrapObjectMethod · 0.80
NewObjectMethod · 0.65
NameMethod · 0.65
ErrorfMethod · 0.45
ErrMethod · 0.45

Tested by 2

TestInternalReadOnlyMethod · 0.76
TestMoveCopyFunction · 0.76