MCPcopy Index your code
hub / github.com/rclone/rclone / Copy

Method Copy

backend/memory/memory.go:536–552  ·  view source on GitHub ↗

Copy src to this remote using server-side copy operations. This is stored with the remote path given. It returns the destination Object and a possible error. Will only be called if src.Fs().Name() == f.Name() If it isn't possible then return fs.ErrorCantCopy

(ctx context.Context, src fs.Object, remote string)

Source from the content-addressed store, hash-verified

534//
535// If it isn't possible then return fs.ErrorCantCopy
536func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error) {
537 dstBucket, dstPath := f.split(remote)
538 _ = buckets.makeBucket(dstBucket)
539 srcObj, ok := src.(*Object)
540 if !ok {
541 fs.Debugf(src, "Can't copy - not same remote type")
542 return nil, fs.ErrorCantCopy
543 }
544 srcBucket, srcPath := srcObj.split()
545 od := buckets.getObjectData(srcBucket, srcPath)
546 if od == nil {
547 return nil, fs.ErrorObjectNotFound
548 }
549 odCopy := *od
550 buckets.updateObjectData(dstBucket, dstPath, &odCopy)
551 return f.NewObject(ctx, remote)
552}
553
554// Hashes returns the supported hash sets.
555func (f *Fs) Hashes() hash.Set {

Callers

nothing calls this directly

Calls 6

splitMethod · 0.95
NewObjectMethod · 0.95
DebugfFunction · 0.92
updateObjectDataMethod · 0.80
makeBucketMethod · 0.45
getObjectDataMethod · 0.45

Tested by

no test coverage detected