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
[shell] use constant for hdd of type (#6337)
Konstantin Lebedevff1392f7f4a8
diff --git a/weed/shell/command_cluster_check.go b/weed/shell/command_cluster_check.goindex 27a4f2bb3d..57b30e0088 100644--- a/weed/shell/command_cluster_check.go+++ b/weed/shell/command_cluster_check.go@@ -4,6 +4,7 @@ import ("context""flag""fmt"+ "github.com/seaweedfs/seaweedfs/weed/storage/types""io""github.com/seaweedfs/seaweedfs/weed/cluster"@@ -79,7 +80,7 @@ func (c *commandClusterCheck) Do(args []string, commandEnv *CommandEnv, writer iif len(filers) > 0 {genericDiskInfo, genericDiskInfoOk := topologyInfo.DiskInfos[""]- hddDiskInfo, hddDiskInfoOk := topologyInfo.DiskInfos["hdd"]+ hddDiskInfo, hddDiskInfoOk := topologyInfo.DiskInfos[types.HddType]if !genericDiskInfoOk && !hddDiskInfoOk {return fmt.Errorf("filer metadata logs need generic or hdd disk type to be defined")diff --git a/weed/shell/command_volume_balance_test.go b/weed/shell/command_volume_balance_test.goindex f1a0c4450a..6c4b2a8184 100644--- a/weed/shell/command_volume_balance_test.go+++ b/weed/shell/command_volume_balance_test.go@@ -265,7 +265,7 @@ func TestBalance(t *testing.T) {func TestVolumeSelection(t *testing.T) {topologyInfo := parseOutput(topoData)- vids, err := collectVolumeIdsForTierChange(topologyInfo, 1000, types.ToDiskType("hdd"), "", 20.0, 0)+ vids, err := collectVolumeIdsForTierChange(topologyInfo, 1000, types.ToDiskType(types.HddType), "", 20.0, 0)if err != nil {t.Errorf("collectVolumeIdsForTierChange: %v", err)}diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.goindex fe7d5f7321..74655df124 100644--- a/weed/shell/command_volume_list.go+++ b/weed/shell/command_volume_list.go@@ -6,6 +6,7 @@ import ("fmt""github.com/seaweedfs/seaweedfs/weed/pb/master_pb""github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding"+ "github.com/seaweedfs/seaweedfs/weed/storage/types""golang.org/x/exp/slices""path/filepath""strings"@@ -72,7 +73,7 @@ func diskInfosToString(diskInfos map[string]*master_pb.DiskInfo) string {var buf bytes.Bufferfor diskType, diskInfo := range diskInfos {if diskType == "" {- diskType = "hdd"+ diskType = types.HddType}fmt.Fprintf(&buf, " %s(volume:%d/%d active:%d free:%d remote:%d)", diskType, diskInfo.VolumeCount, diskInfo.MaxVolumeCount, diskInfo.ActiveVolumeCount, diskInfo.FreeVolumeCount, diskInfo.RemoteVolumeCount)}@@ -162,7 +163,7 @@ func (c *commandVolumeList) writeDiskInfo(writer io.Writer, t *master_pb.DiskInfvar s statisticsdiskType := t.Typeif diskType == "" {- diskType = "hdd"+ diskType = types.HddType}output(verbosityLevel >= 4, writer, " Disk %s(%s)\n", diskType, diskInfoToString(t))slices.SortFunc(t.VolumeInfos, func(a, b *master_pb.VolumeInformationMessage) int {diff --git a/weed/storage/disk_location_test.go b/weed/storage/disk_location_test.goindex d105a477f7..d2823588f9 100644--- a/weed/storage/disk_location_test.go+++ b/weed/storage/disk_location_test.go@@ -1,6 +1,7 @@package storageimport (+ "github.com/seaweedfs/seaweedfs/weed/storage/types""testing""time"@@ -40,7 +41,7 @@ func TestUnUsedSpace(t *testing.T) {Directory: "/test/",DirectoryUuid: "1234",IdxDirectory: "/test/",- DiskType: "hdd",+ DiskType: types.HddType,MaxVolumeCount: 0,OriginalMaxVolumeCount: 0,MinFreeSpace: minFreeSpace,diff --git a/weed/storage/types/volume_disk_type.go b/weed/storage/types/volume_disk_type.goindex c9b87d8026..04c5190704 100644--- a/weed/storage/types/volume_disk_type.go+++ b/weed/storage/types/volume_disk_type.go@@ -8,6 +8,7 @@ type DiskType stringconst (HardDriveType DiskType = ""+ HddType = "hdd"SsdType = "ssd")@@ -15,7 +16,7 @@ func ToDiskType(vt string) (diskType DiskType) {vt = strings.ToLower(vt)diskType = HardDriveTypeswitch vt {- case "", "hdd":+ case "", HddType:diskType = HardDriveTypecase "ssd":diskType = SsdType@@ -34,7 +35,7 @@ func (diskType DiskType) String() string {func (diskType DiskType) ReadableString() string {if diskType == "" {- return "hdd"+ return HddType}return string(diskType)}