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
refactoring
Chris Lu4d1484628adb
diff --git a/weed/command/volume.go b/weed/command/volume.goindex c7eac95b6f..1b222f0903 100644--- a/weed/command/volume.go+++ b/weed/command/volume.go@@ -52,7 +52,7 @@ type VolumeServerOptions struct {memProfile *stringcompactionMBPerSecond *intfileSizeLimitMB *int- minFreeSpacePercent []float32+ minFreeSpacePercents []float32pprof *bool// pulseSeconds *int}@@ -137,18 +137,18 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, vminFreeSpacePercentStrings := strings.Split(minFreeSpacePercent, ",")for _, freeString := range minFreeSpacePercentStrings {if value, e := strconv.ParseFloat(freeString, 32); e == nil {- v.minFreeSpacePercent = append(v.minFreeSpacePercent, float32(value))+ v.minFreeSpacePercents = append(v.minFreeSpacePercents, float32(value))} else {glog.Fatalf("The value specified in -minFreeSpacePercent not a valid value %s", freeString)}}- if len(v.minFreeSpacePercent) == 1 && len(v.folders) > 1 {+ if len(v.minFreeSpacePercents) == 1 && len(v.folders) > 1 {for i := 0; i < len(v.folders)-1; i++ {- v.minFreeSpacePercent = append(v.minFreeSpacePercent, v.minFreeSpacePercent[0])+ v.minFreeSpacePercents = append(v.minFreeSpacePercents, v.minFreeSpacePercents[0])}}- if len(v.folders) != len(v.minFreeSpacePercent) {- glog.Fatalf("%d directories by -dir, but only %d minFreeSpacePercent is set by -minFreeSpacePercent", len(v.folders), len(v.minFreeSpacePercent))+ if len(v.folders) != len(v.minFreeSpacePercents) {+ glog.Fatalf("%d directories by -dir, but only %d minFreeSpacePercent is set by -minFreeSpacePercent", len(v.folders), len(v.minFreeSpacePercents))}// security related white list configuration@@ -196,7 +196,7 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, vvolumeServer := weed_server.NewVolumeServer(volumeMux, publicVolumeMux,*v.ip, *v.port, *v.publicUrl,- v.folders, v.folderMaxLimits, v.minFreeSpacePercent,+ v.folders, v.folderMaxLimits, v.minFreeSpacePercents,volumeNeedleMapKind,strings.Split(masters, ","), 5, *v.dataCenter, *v.rack,v.whiteList,diff --git a/weed/server/volume_server.go b/weed/server/volume_server.goindex 367e39d8a7..b7ed81be07 100644--- a/weed/server/volume_server.go+++ b/weed/server/volume_server.go@@ -34,7 +34,7 @@ type VolumeServer struct {func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,port int, publicUrl string,- folders []string, maxCounts []int, minFreeSpacePercent []float32,+ folders []string, maxCounts []int, minFreeSpacePercents []float32,needleMapKind storage.NeedleMapType,masterNodes []string, pulseSeconds int,dataCenter string, rack string,@@ -65,7 +65,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,fileSizeLimitBytes: int64(fileSizeLimitMB) * 1024 * 1024,}vs.SeedMasterNodes = masterNodes- vs.store = storage.NewStore(vs.grpcDialOption, port, ip, publicUrl, folders, maxCounts, minFreeSpacePercent, vs.needleMapKind)+ vs.store = storage.NewStore(vs.grpcDialOption, port, ip, publicUrl, folders, maxCounts, minFreeSpacePercents, vs.needleMapKind)vs.guard = security.NewGuard(whiteList, signingKey, expiresAfterSec, readSigningKey, readExpiresAfterSec)handleStaticResources(adminMux)diff --git a/weed/storage/store.go b/weed/storage/store.goindex 2aff8c93fc..0ac3381c5b 100644--- a/weed/storage/store.go+++ b/weed/storage/store.go@@ -48,11 +48,11 @@ func (s *Store) String() (str string) {return}-func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, freeDiskSpaceWatermark []float32, needleMapKind NeedleMapType) (s *Store) {+func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, minFreeSpacePercents []float32, needleMapKind NeedleMapType) (s *Store) {s = &Store{grpcDialOption: grpcDialOption, Port: port, Ip: ip, PublicUrl: publicUrl, NeedleMapType: needleMapKind}s.Locations = make([]*DiskLocation, 0)for i := 0; i < len(dirnames); i++ {- location := NewDiskLocation(dirnames[i], maxVolumeCounts[i], freeDiskSpaceWatermark[i])+ location := NewDiskLocation(dirnames[i], maxVolumeCounts[i], minFreeSpacePercents[i])location.loadExistingVolumes(needleMapKind)s.Locations = append(s.Locations, location)stats.VolumeServerMaxVolumeCounter.Add(float64(maxVolumeCounts[i]))