// Copy or Move 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/fs.ErrorCantMove
Copy or Move 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/fs.ErrorCantMove
// Copy or Move 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 / fs . ErrorCantMove
func (f *Fs) copyOrMove(src fs.Object, remote string, method string) (fs.Object, error) {
	srcObj, ok := src.(*Object)
	if !ok {
		fs.Debugf(src, "Can't copy - not same remote type")
		if method == "COPY" {
			return nil, fs.ErrorCantCopy
		}
		return nil, fs.ErrorCantMove
	}
	dstPath := f.filePath(remote)
	err := f.mkParentDir(dstPath)
	if err != nil {
		return nil, errors.Wrap(err, "Copy mkParentDir failed")
	}
	destinationURL, err := rest.URLJoin(f.endpoint, dstPath)
	if err != nil {
		return nil, errors.Wrap(err, "copyOrMove couldn't join URL")
	}
	var resp *http.Response
	opts := rest.Opts{
		Method:     method,
		Path:       srcObj.filePath(),
		NoResponse: true,
		ExtraHeaders: map[string]string{
			"Destination": destinationURL.String(),
			"Overwrite":   "F",
		},
	}
	if f.useOCMtime {
		opts.ExtraHeaders["X-OC-Mtime"] = fmt.Sprintf("%f", float64(src.ModTime().UnixNano())/1E9)
	}
	err = f.pacer.Call(func() (bool, error) {
		resp, err = f.srv.Call(&opts)
		return shouldRetry(resp, err)
	})
	if err != nil {
		return nil, errors.Wrap(err, "Copy call failed")
	}
	dstObj, err := f.NewObject(remote)
	if err != nil {
		return nil, errors.Wrap(err, "Copy NewObject failed")
	}
	return dstObj, nil
}
func ( f * Fs ) copyOrMove ( src fs . Object , remote string , method string ) ( fs . Object , error ) { srcObj , ok := src . ( * Object ) if ! ok { fs . Debugf ( src , " " ) if method == " " { return nil , fs . ErrorCantCopy } return nil , fs . ErrorCantMove } dstPath := f . filePath ( remote ) err := f . mkParentDir ( dstPath ) if err != nil { return nil , errors . Wrap ( err , " " ) } destinationURL , err := rest . URLJoin ( f . endpoint , dstPath ) if err != nil { return nil , errors . Wrap ( err , " " ) } var resp * http . Response opts := rest . Opts { Method : method , Path : srcObj . filePath ( ) , NoResponse : true , ExtraHeaders : map [ string ] string { " " : destinationURL . String ( ) , " " : " " , } , } if f . useOCMtime { opts . ExtraHeaders [ " " ] = fmt . Sprintf ( " " , float64 ( src . ModTime ( ) . UnixNano ( ) ) / 1E9 ) } err = f . pacer . Call ( func ( ) ( bool , error ) { resp , err = f . srv . Call ( & opts ) return shouldRetry ( resp , err ) } ) if err != nil { return nil , errors . Wrap ( err , " " ) } dstObj , err := f . NewObject ( remote ) if err != nil { return nil , errors . Wrap ( err , " " ) } return dstObj , nil }
Copy or Move src to this remote using server side copy operations.
Copy or Move src to this remote using server side copy operations .