aboutsummaryrefslogtreecommitdiff
path: root/object.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-05-02 22:46:10 +0200
committerStefan Majewsky <majewsky@gmx.net>2018-05-02 22:46:11 +0200
commit1a64fd95e191e87b9d0c1e0e9556cff92fc230a5 (patch)
treef2b552052648907ebc3f7610830fa9e63e2af07a /object.go
parentfc023fb7387772b70496d24449e301cd856634ff (diff)
downloadgo-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).
Diffstat (limited to 'object.go')
-rw-r--r--object.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/object.go b/object.go
index a7b19df..d44c152 100644
--- a/object.go
+++ b/object.go
@@ -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)