[shell] use constant for hdd of type (#6337)

use constant for hdd of type
This commit is contained in:
Konstantin Lebedev
2024-12-10 18:43:59 +02:00
committed by GitHub
parent 4f6c989309
commit ff1392f7f4
5 changed files with 11 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package storage
import (
"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,

View File

@@ -8,6 +8,7 @@ type DiskType string
const (
HardDriveType DiskType = ""
HddType = "hdd"
SsdType = "ssd"
)
@@ -15,7 +16,7 @@ func ToDiskType(vt string) (diskType DiskType) {
vt = strings.ToLower(vt)
diskType = HardDriveType
switch vt {
case "", "hdd":
case "", HddType:
diskType = HardDriveType
case "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)
}