adding volume type

This commit is contained in:
Chris Lu
2020-12-13 00:58:58 -08:00
parent 16cd6fb278
commit e9cd798bd3
35 changed files with 830 additions and 742 deletions

View File

@@ -14,6 +14,7 @@ type VolumeInfo struct {
Size uint64
ReplicaPlacement *super_block.ReplicaPlacement
Ttl *needle.TTL
VolumeType VolumeType
Collection string
Version needle.Version
FileCount int

View File

@@ -0,0 +1,23 @@
package storage
import "fmt"
type VolumeType string
const (
HardDriveType VolumeType = ""
SsdType = "ssd"
)
func ToVolumeType(vt string) (volumeType VolumeType, err error) {
volumeType = HardDriveType
switch vt {
case "", "hdd":
volumeType = HardDriveType
case "ssd":
volumeType = SsdType
default:
err = fmt.Errorf("parse VolumeType %s: expecting hdd or ssd\n", vt)
}
return
}