Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snowball: Support per object advanced PUT options #1901

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions api-putobject-snowball.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"context"
"fmt"
"io"
"net/http"
"os"
"strings"
"sync"
Expand Down Expand Up @@ -70,6 +71,14 @@ type SnowballObject struct {
// Exactly 'Size' number of bytes must be provided.
Content io.Reader

// VersionID of the object; if empty, a new versionID will be generated
VersionID string

// Headers contains more options for this object upload, the same as you
// would include in a regular PutObject operation, such as user metadata
// and content-disposition, expires, ..
Headers http.Header

// Close will be called when an object has finished processing.
// Note that if PutObjectsSnowball returns because of an error,
// objects not consumed from the input will NOT have been closed.
Expand Down Expand Up @@ -181,6 +190,14 @@ objectLoop:
header.ModTime = time.Now().UTC()
}

header.PAXRecords = make(map[string]string)
if obj.VersionID != "" {
header.PAXRecords["minio.versionId"] = obj.VersionID
}
for k, vals := range obj.Headers {
header.PAXRecords["minio.metadata."+k] = strings.Join(vals, ",")
}

if err := t.WriteHeader(&header); err != nil {
closeObj()
return err
Expand Down