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
add options params for the Assign func
霍晓栋79b0a581327b
diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.goindex acc2d3034c..a893e836b4 100644--- a/weed/operation/assign_file_id.go+++ b/weed/operation/assign_file_id.go@@ -19,7 +19,13 @@ type AssignResult struct {Error string `json:"error,omitempty"`}-func Assign(server string, count uint64, replication string, collection string, ttl string) (*AssignResult, error) {+/*+options params meaning:+options[0] main data Center+options[1] main rack+options[2] main data node+*/+func Assign(server string, count uint64, replication string, collection string, ttl string, options ...string) (*AssignResult, error) {values := make(url.Values)values.Add("count", strconv.FormatUint(count, 10))if replication != "" {@@ -31,6 +37,31 @@ func Assign(server string, count uint64, replication string, collection string,if ttl != "" {values.Add("ttl", ttl)}++ var dataCenter, rack, dataNode string+ switch len(options) {+ case 1:+ dataCenter = options[0]+ case 2:+ dataCenter = options[0]+ rack = options[1]+ case 3:+ dataCenter = options[0]+ rack = options[1]+ dataNode = options[2]+ default:+ }++ if dataCenter != "" {+ values.Add("dataCenter", dataCenter)+ }+ if rack != "" {+ values.Add("rack", rack)+ }+ if dataNode != "" {+ values.Add("dataNode", dataNode)+ }+jsonBlob, err := util.Post("http://"+server+"/dir/assign", values)glog.V(2).Info("assign result :", string(jsonBlob))if err != nil {