mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 10:07:24 +08:00
rename from volumeType to diskType
This commit is contained in:
@@ -19,7 +19,7 @@ import (
|
||||
type DiskLocation struct {
|
||||
Directory string
|
||||
IdxDirectory string
|
||||
VolumeType VolumeType
|
||||
DiskType DiskType
|
||||
MaxVolumeCount int
|
||||
OriginalMaxVolumeCount int
|
||||
MinFreeSpacePercent float32
|
||||
@@ -33,7 +33,7 @@ type DiskLocation struct {
|
||||
isDiskSpaceLow bool
|
||||
}
|
||||
|
||||
func NewDiskLocation(dir string, maxVolumeCount int, minFreeSpacePercent float32, idxDir string, volumeType VolumeType) *DiskLocation {
|
||||
func NewDiskLocation(dir string, maxVolumeCount int, minFreeSpacePercent float32, idxDir string, diskType DiskType) *DiskLocation {
|
||||
dir = util.ResolvePath(dir)
|
||||
if idxDir == "" {
|
||||
idxDir = dir
|
||||
@@ -43,7 +43,7 @@ func NewDiskLocation(dir string, maxVolumeCount int, minFreeSpacePercent float32
|
||||
location := &DiskLocation{
|
||||
Directory: dir,
|
||||
IdxDirectory: idxDir,
|
||||
VolumeType: volumeType,
|
||||
DiskType: diskType,
|
||||
MaxVolumeCount: maxVolumeCount,
|
||||
OriginalMaxVolumeCount: maxVolumeCount,
|
||||
MinFreeSpacePercent: minFreeSpacePercent,
|
||||
|
@@ -52,11 +52,11 @@ func (s *Store) String() (str string) {
|
||||
return
|
||||
}
|
||||
|
||||
func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, minFreeSpacePercents []float32, idxFolder string, needleMapKind NeedleMapType, volumeType VolumeType) (s *Store) {
|
||||
func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, minFreeSpacePercents []float32, idxFolder string, needleMapKind NeedleMapType, diskType DiskType) (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], minFreeSpacePercents[i], idxFolder, volumeType)
|
||||
location := NewDiskLocation(dirnames[i], maxVolumeCounts[i], minFreeSpacePercents[i], idxFolder, diskType)
|
||||
location.loadExistingVolumes(needleMapKind)
|
||||
s.Locations = append(s.Locations, location)
|
||||
stats.VolumeServerMaxVolumeCounter.Add(float64(maxVolumeCounts[i]))
|
||||
@@ -209,7 +209,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||
collectionVolumeReadOnlyCount := make(map[string]map[string]uint8)
|
||||
for _, location := range s.Locations {
|
||||
var deleteVids []needle.VolumeId
|
||||
switch location.VolumeType {
|
||||
switch location.DiskType {
|
||||
case SsdType:
|
||||
maxSsdVolumeCount = maxSsdVolumeCount + location.MaxVolumeCount
|
||||
case HardDriveType:
|
||||
|
@@ -262,7 +262,7 @@ func (v *Volume) ToVolumeInformationMessage() (types.NeedleId, *master_pb.Volume
|
||||
Ttl: v.Ttl.ToUint32(),
|
||||
CompactRevision: uint32(v.SuperBlock.CompactionRevision),
|
||||
ModifiedAtSecond: modTime.Unix(),
|
||||
VolumeType: string(v.location.VolumeType),
|
||||
DiskType: string(v.location.DiskType),
|
||||
}
|
||||
|
||||
volumeInfo.RemoteStorageName, volumeInfo.RemoteStorageKey = v.RemoteStorageNameKey()
|
||||
|
@@ -14,7 +14,7 @@ type VolumeInfo struct {
|
||||
Size uint64
|
||||
ReplicaPlacement *super_block.ReplicaPlacement
|
||||
Ttl *needle.TTL
|
||||
VolumeType string
|
||||
DiskType string
|
||||
Collection string
|
||||
Version needle.Version
|
||||
FileCount int
|
||||
@@ -41,7 +41,7 @@ func NewVolumeInfo(m *master_pb.VolumeInformationMessage) (vi VolumeInfo, err er
|
||||
ModifiedAtSecond: m.ModifiedAtSecond,
|
||||
RemoteStorageName: m.RemoteStorageName,
|
||||
RemoteStorageKey: m.RemoteStorageKey,
|
||||
VolumeType: m.VolumeType,
|
||||
DiskType: m.DiskType,
|
||||
}
|
||||
rp, e := super_block.NewReplicaPlacementFromByte(byte(m.ReplicaPlacement))
|
||||
if e != nil {
|
||||
@@ -92,7 +92,7 @@ func (vi VolumeInfo) ToVolumeInformationMessage() *master_pb.VolumeInformationMe
|
||||
ModifiedAtSecond: vi.ModifiedAtSecond,
|
||||
RemoteStorageName: vi.RemoteStorageName,
|
||||
RemoteStorageKey: vi.RemoteStorageKey,
|
||||
VolumeType: vi.VolumeType,
|
||||
DiskType: vi.DiskType,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,22 +2,22 @@ package storage
|
||||
|
||||
import "fmt"
|
||||
|
||||
type VolumeType string
|
||||
type DiskType string
|
||||
|
||||
const (
|
||||
HardDriveType VolumeType = ""
|
||||
HardDriveType DiskType = ""
|
||||
SsdType = "ssd"
|
||||
)
|
||||
|
||||
func ToVolumeType(vt string) (volumeType VolumeType, err error) {
|
||||
volumeType = HardDriveType
|
||||
func ToDiskType(vt string) (diskType DiskType, err error) {
|
||||
diskType = HardDriveType
|
||||
switch vt {
|
||||
case "", "hdd":
|
||||
volumeType = HardDriveType
|
||||
diskType = HardDriveType
|
||||
case "ssd":
|
||||
volumeType = SsdType
|
||||
diskType = SsdType
|
||||
default:
|
||||
err = fmt.Errorf("parse VolumeType %s: expecting hdd or ssd\n", vt)
|
||||
err = fmt.Errorf("parse DiskType %s: expecting hdd or ssd\n", vt)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user