diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-12-13 11:59:32 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-12-13 11:59:32 -0800 |
| commit | 0d2ec832e2ced90371f2c5549b175d5b93becd1a (patch) | |
| tree | 8f4fddcc88491331b0e395c1606b8cb9d6d00513 /weed/storage | |
| parent | 715b199eeb6fbd3f028b99e42097096fdcac5e09 (diff) | |
| download | seaweedfs-0d2ec832e2ced90371f2c5549b175d5b93becd1a.tar.xz seaweedfs-0d2ec832e2ced90371f2c5549b175d5b93becd1a.zip | |
rename from volumeType to diskType
Diffstat (limited to 'weed/storage')
| -rw-r--r-- | weed/storage/disk_location.go | 6 | ||||
| -rw-r--r-- | weed/storage/store.go | 6 | ||||
| -rw-r--r-- | weed/storage/volume.go | 2 | ||||
| -rw-r--r-- | weed/storage/volume_info.go | 6 | ||||
| -rw-r--r-- | weed/storage/volume_type.go | 14 |
5 files changed, 17 insertions, 17 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index ef224cc4a..88a52ccd8 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -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, diff --git a/weed/storage/store.go b/weed/storage/store.go index 1a1bc2e67..1b1c771df 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -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: diff --git a/weed/storage/volume.go b/weed/storage/volume.go index fdfb68c43..ebc1bff3e 100644 --- a/weed/storage/volume.go +++ b/weed/storage/volume.go @@ -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() diff --git a/weed/storage/volume_info.go b/weed/storage/volume_info.go index 5aaf42735..24577618e 100644 --- a/weed/storage/volume_info.go +++ b/weed/storage/volume_info.go @@ -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, } } diff --git a/weed/storage/volume_type.go b/weed/storage/volume_type.go index 5504b4386..05cd6b2c3 100644 --- a/weed/storage/volume_type.go +++ b/weed/storage/volume_type.go @@ -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 } |
