adjusting for types

This commit is contained in:
Chris Lu committed 2012-08-23 22:56:14 -07:00
1 parent 5e3ecc1b82
commit 9f92f2779d
6 files changed
+30 -31

No files matched your search

+7 -8
View File
@@ -7,7 +7,6 @@ import (
"net/url"
"strconv"
"strings"
"pkg/topology"
"pkg/util"
)
@@ -60,20 +59,20 @@ func (s *Store) addVolume(vid VolumeId) error {
s.volumes[vid] = NewVolume(s.dir, vid)
return nil
}
func (s *Store) Status() *[]*topology.VolumeInfo {
stats := new([]*topology.VolumeInfo)
func (s *Store) Status() *[]*VolumeInfo {
stats := new([]*VolumeInfo)
for k, v := range s.volumes {
s := new(topology.VolumeInfo)
s.Id, s.Size = topology.VolumeId(k), v.Size()
s := new(VolumeInfo)
s.Id, s.Size = VolumeId(k), v.Size()
*stats = append(*stats, s)
}
return stats
}
func (s *Store) Join(mserver string) {
stats := new([]*topology.VolumeInfo)
stats := new([]*VolumeInfo)
for k, v := range s.volumes {
s := new(topology.VolumeInfo)
s.Id, s.Size = topology.VolumeId(k), v.Size()
s := new(VolumeInfo)
s.Id, s.Size = VolumeId(k), v.Size()
*stats = append(*stats, s)
}
bytes, _ := json.Marshal(stats)
+4
View File
@@ -14,6 +14,10 @@ const (
)
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