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)
| 534 | // |
| 535 | // If it isn't possible then return fs.ErrorCantCopy |
| 536 | func (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. |
| 555 | func (f *Fs) Hashes() hash.Set { |
nothing calls this directly
no test coverage detected