Browse Source

simplify volume.go file

pull/2/head
Chris Lu 13 years ago
parent
commit
9b4ce65882
  1. 13
      weed-fs/src/pkg/storage/volume.go
  2. 14
      weed-fs/src/pkg/storage/volume_id.go
  3. 10
      weed-fs/src/pkg/storage/volume_info.go

13
weed-fs/src/pkg/storage/volume.go

@ -5,7 +5,6 @@ import (
"log" "log"
"os" "os"
"path" "path"
"strconv"
"sync" "sync"
) )
@ -13,18 +12,6 @@ const (
SuperBlockSize = 8 SuperBlockSize = 8
) )
type VolumeId uint32
type VolumeInfo struct {
Id VolumeId
Size int64
}
func NewVolumeId(vid string) (VolumeId,error) {
volumeId, err := strconv.ParseUint(vid, 10, 64)
return VolumeId(volumeId), err
}
func (vid *VolumeId) String() string{
return strconv.FormatUint(uint64(*vid), 10)
}
type Volume struct { type Volume struct {
Id VolumeId Id VolumeId
dir string dir string

14
weed-fs/src/pkg/storage/volume_id.go

@ -0,0 +1,14 @@
package storage
import (
"strconv"
)
type VolumeId uint32
func NewVolumeId(vid string) (VolumeId,error) {
volumeId, err := strconv.ParseUint(vid, 10, 64)
return VolumeId(volumeId), err
}
func (vid *VolumeId) String() string{
return strconv.FormatUint(uint64(*vid), 10)
}

10
weed-fs/src/pkg/storage/volume_info.go

@ -0,0 +1,10 @@
package storage
import (
)
type VolumeInfo struct {
Id VolumeId
Size int64
}
Loading…
Cancel
Save