Browse Source

test s3 put

pull/7426/head
Konstantin Lebedev 1 month ago
parent
commit
1abea0d9b5
  1. 2
      weed/s3api/filer_multipart.go
  2. 6
      weed/server/filer_server_handlers_write.go
  3. 23
      weed/server/filer_server_handlers_write_autochunk.go

2
weed/s3api/filer_multipart.go

@ -468,7 +468,7 @@ func (s3a *S3ApiServer) completeMultipartUpload(r *http.Request, input *s3.Compl
entry.Attributes.Mime = mime
}
entry.Attributes.FileSize = uint64(offset)
if s3a.option.AllowDeleteObjectsByTTL && entry.Attributes.TtlSec > 0 {
if s3a.option.AllowDeleteObjectsByTTL {
entry.Extended[s3_constants.SeaweedFSExpiresS3] = []byte("true")
}
})

6
weed/server/filer_server_handlers_write.go

@ -98,12 +98,6 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request, conte
}
return
}
// Disable TTL-based (creation time) deletion when S3 expiry (modification time) is enabled
if so.TtlSeconds > 0 {
if s3ExpiresValue := r.Header.Get(s3_constants.SeaweedFSExpiresS3); s3ExpiresValue == "true" {
so.TtlSeconds = 0
}
}
if util.FullPath(r.URL.Path).IsLongerFileName(so.MaxFileNameLength) {
glog.V(1).InfolnCtx(ctx, "post", r.RequestURI, ": ", "entry name too long")
w.WriteHeader(http.StatusRequestURITooLong)

23
weed/server/filer_server_handlers_write_autochunk.go

@ -136,8 +136,27 @@ func (fs *FilerServer) doPutAutoChunk(ctx context.Context, w http.ResponseWriter
if err := fs.checkPermissions(ctx, r, fileName); err != nil {
return nil, nil, err
}
fileChunks, md5Hash, chunkOffset, err, smallContent := fs.uploadRequestToChunks(ctx, w, r, r.Body, chunkSize, fileName, contentType, contentLength, so)
// Disable TTL-based (creation time) deletion when S3 expiry (modification time) is enabled
soMaybeWithOutTTL := so
if so.TtlSeconds > 0 {
if s3ExpiresValue := r.Header.Get(s3_constants.SeaweedFSExpiresS3); s3ExpiresValue == "true" {
soMaybeWithOutTTL = &operation.StorageOption{
so.Replication,
so.DiskType,
so.Collection,
so.DataCenter,
so.Rack,
so.DataNode,
0,
so.VolumeGrowthCount,
so.MaxFileNameLength,
so.Fsync,
so.SaveInside,
}
}
}
fileChunks, md5Hash, chunkOffset, err, smallContent := fs.uploadRequestToChunks(ctx, w, r, r.Body, chunkSize, fileName, contentType, contentLength, soMaybeWithOutTTL)
if err != nil {
return nil, nil, err

Loading…
Cancel
Save