1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-05-29 06:40:21 +02:00
seaweedfs/weed/storage/types/volume_disk_type.go

41 lines
598 B
Go

package types
import (
"strings"
)
type DiskType string
const (
HardDriveType DiskType = ""
SsdType = "ssd"
)
func ToDiskType(vt string) (diskType DiskType) {
vt = strings.ToLower(vt)
diskType = HardDriveType
switch vt {
case "", "hdd":
diskType = HardDriveType
case "ssd":
diskType = SsdType
default:
diskType = DiskType(vt)
}
return
}
func (diskType DiskType) String() string {
if diskType == "" {
return ""
}
return string(diskType)
}
func (diskType DiskType) ReadableString() string {
if diskType == "" {
return "hdd"
}
return string(diskType)
}