SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
[Filer] post add param:saveInside (#4434)
zemule9fda774f44a
diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.goindex 135c5201e9..c2f5a806de 100644--- a/weed/operation/assign_file_id.go+++ b/weed/operation/assign_file_id.go@@ -137,6 +137,7 @@ type StorageOption struct {TtlSeconds int32Fsync boolVolumeGrowthCount uint32+ SaveInside bool}func (so *StorageOption) TtlString() string {diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.goindex 11019c7d26..898975d142 100644--- a/weed/server/filer_server_handlers_write.go+++ b/weed/server/filer_server_handlers_write.go@@ -87,6 +87,7 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request, contequery.Get("dataCenter"),query.Get("rack"),query.Get("dataNode"),+ query.Get("saveInside"),)if err != nil {if err == ErrReadOnly {@@ -103,6 +104,10 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request, conteso.DiskType = fs.option.DiskType}+ if strings.HasPrefix(r.URL.Path, "/etc") {+ so.SaveInside = true+ }+if query.Has("mv.from") {fs.move(ctx, w, r, so)} else {@@ -246,7 +251,7 @@ func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication}, nil}-func (fs *FilerServer) detectStorageOption0(requestURI, qCollection, qReplication string, qTtl string, diskType string, fsync string, dataCenter, rack, dataNode string) (*operation.StorageOption, error) {+func (fs *FilerServer) detectStorageOption0(requestURI, qCollection, qReplication string, qTtl string, diskType string, fsync string, dataCenter, rack, dataNode, saveInside string) (*operation.StorageOption, error) {ttl, err := needle.ReadTTL(qTtl)if err != nil {@@ -260,6 +265,11 @@ func (fs *FilerServer) detectStorageOption0(requestURI, qCollection, qReplicatio} else if fsync == "true" {so.Fsync = true}+ if saveInside == "true" {+ so.SaveInside = true+ } else {+ so.SaveInside = false+ }}return so, errdiff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.goindex 6732db195e..27519bee70 100644--- a/weed/server/filer_server_handlers_write_autochunk.go+++ b/weed/server/filer_server_handlers_write_autochunk.go@@ -1,6 +1,7 @@package weed_serverimport (+ "bytes""context""fmt"//"github.com/seaweedfs/seaweedfs/weed/s3api"@@ -64,7 +65,6 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r *}func (fs *FilerServer) doPostAutoChunk(ctx context.Context, w http.ResponseWriter, r *http.Request, chunkSize int32, contentLength int64, so *operation.StorageOption) (filerResult *FilerPostResult, md5bytes []byte, replyerr error) {-multipartReader, multipartReaderErr := r.MultipartReader()if multipartReaderErr != nil {return nil, nil, multipartReaderErr@@ -84,6 +84,15 @@ func (fs *FilerServer) doPostAutoChunk(ctx context.Context, w http.ResponseWritecontentType = ""}+ if so.SaveInside {+ buf := bufPool.Get().(*bytes.Buffer)+ buf.Reset()+ buf.ReadFrom(part1)+ filerResult, replyerr = fs.saveMetaData(ctx, r, fileName, contentType, so, nil, nil, 0, buf.Bytes())+ bufPool.Put(buf)+ return+ }+fileChunks, md5Hash, chunkOffset, err, smallContent := fs.uploadReaderToChunks(w, r, part1, chunkSize, fileName, contentType, contentLength, so)if err != nil {return nil, nil, err