Skip to content

Commit 0108287

Browse files
authored
snowball: Support per object advanced PUT options (#1901)
1 parent 6eebdd6 commit 0108287

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

api-putobject-snowball.go

+17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"context"
2525
"fmt"
2626
"io"
27+
"net/http"
2728
"os"
2829
"strings"
2930
"sync"
@@ -70,6 +71,14 @@ type SnowballObject struct {
7071
// Exactly 'Size' number of bytes must be provided.
7172
Content io.Reader
7273

74+
// VersionID of the object; if empty, a new versionID will be generated
75+
VersionID string
76+
77+
// Headers contains more options for this object upload, the same as you
78+
// would include in a regular PutObject operation, such as user metadata
79+
// and content-disposition, expires, ..
80+
Headers http.Header
81+
7382
// Close will be called when an object has finished processing.
7483
// Note that if PutObjectsSnowball returns because of an error,
7584
// objects not consumed from the input will NOT have been closed.
@@ -181,6 +190,14 @@ objectLoop:
181190
header.ModTime = time.Now().UTC()
182191
}
183192

193+
header.PAXRecords = make(map[string]string)
194+
if obj.VersionID != "" {
195+
header.PAXRecords["minio.versionId"] = obj.VersionID
196+
}
197+
for k, vals := range obj.Headers {
198+
header.PAXRecords["minio.metadata."+k] = strings.Join(vals, ",")
199+
}
200+
184201
if err := t.WriteHeader(&header); err != nil {
185202
closeObj()
186203
return err

0 commit comments

Comments
 (0)