diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-05-02 22:46:10 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-05-02 22:46:11 +0200 |
| commit | 1a64fd95e191e87b9d0c1e0e9556cff92fc230a5 (patch) | |
| tree | f2b552052648907ebc3f7610830fa9e63e2af07a | |
| parent | fc023fb7387772b70496d24449e301cd856634ff (diff) | |
| download | go-schwift-1a64fd95e191e87b9d0c1e0e9556cff92fc230a5.tar.gz | |
add (currently empty) CopyOptions arg to Object.CopyTo
For backwards compatiblity when later expanding the scope of this
function (analogous to DeleteOptions, UploadOptions, TruncateOptions).
| -rw-r--r-- | object.go | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -425,6 +425,12 @@ func (o *Object) Download(opts *RequestOptions) DownloadedObject { return DownloadedObject{body, err} } +//CopyOptions invokes advanced behavior in the Object.Copy() method. +// +//It's empty right now, but has been added providently to make future expansion +//backwards-compatible. +type CopyOptions struct{} + //CopyTo copies the object on the server side using a COPY request. To copy //only the content, not the metadata, use the X-Fresh-Metadata header: // @@ -438,18 +444,18 @@ func (o *Object) Download(opts *RequestOptions) DownloadedObject { // //A successful COPY implies target.Invalidate() since it may change the //target's metadata. -func (o *Object) CopyTo(target *Object, opts *RequestOptions) error { - opts = cloneRequestOptions(opts, nil) - opts.Headers.Set("Destination", target.FullName()) +func (o *Object) CopyTo(target *Object, opts *CopyOptions, ropts *RequestOptions) error { + ropts = cloneRequestOptions(ropts, nil) + ropts.Headers.Set("Destination", target.FullName()) if o.c.a.name != target.c.a.name { - opts.Headers.Set("Destination-Account", target.c.a.name) + ropts.Headers.Set("Destination-Account", target.c.a.name) } _, err := Request{ Method: "COPY", ContainerName: o.c.name, ObjectName: o.name, - Options: opts, + Options: ropts, ExpectStatusCodes: []int{201}, DrainResponseBody: true, }.Do(o.c.a.backend) |
