aboutsummaryrefslogtreecommitdiff
path: root/weed/operation/upload_content.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/operation/upload_content.go')
-rw-r--r--weed/operation/upload_content.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go
index a48cf5ea2..c46b82cae 100644
--- a/weed/operation/upload_content.go
+++ b/weed/operation/upload_content.go
@@ -66,6 +66,29 @@ func (uploadResult *UploadResult) ToPbFileChunk(fileId string, offset int64, tsN
}
}
+// ToPbFileChunkWithSSE creates a FileChunk with SSE metadata
+func (uploadResult *UploadResult) ToPbFileChunkWithSSE(fileId string, offset int64, tsNs int64, sseType filer_pb.SSEType, sseKmsMetadata []byte) *filer_pb.FileChunk {
+ fid, _ := filer_pb.ToFileIdObject(fileId)
+ chunk := &filer_pb.FileChunk{
+ FileId: fileId,
+ Offset: offset,
+ Size: uint64(uploadResult.Size),
+ ModifiedTsNs: tsNs,
+ ETag: uploadResult.ContentMd5,
+ CipherKey: uploadResult.CipherKey,
+ IsCompressed: uploadResult.Gzip > 0,
+ Fid: fid,
+ }
+
+ // Add SSE metadata if provided
+ chunk.SseType = sseType
+ if len(sseKmsMetadata) > 0 {
+ chunk.SseKmsMetadata = sseKmsMetadata
+ }
+
+ return chunk
+}
+
var (
fileNameEscaper = strings.NewReplacer(`\`, `\\`, `"`, `\"`, "\n", "")
uploader *Uploader