aboutsummaryrefslogtreecommitdiff
path: root/weed-fs/src/pkg
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2012-08-23 19:10:55 -0700
committerChris Lu <chris.lu@gmail.com>2012-08-23 19:10:55 -0700
commit5caa7bbdc94956d449b42fd542fe3e683b3e5249 (patch)
tree6cbc9c8fc1eb590bd2b3b76ef1719948dbd93d42 /weed-fs/src/pkg
parent10c2a4540ef8e9971e06c1a9618acf7fa8d31153 (diff)
downloadseaweedfs-5caa7bbdc94956d449b42fd542fe3e683b3e5249.tar.xz
seaweedfs-5caa7bbdc94956d449b42fd542fe3e683b3e5249.zip
refactoring only
Diffstat (limited to 'weed-fs/src/pkg')
-rw-r--r--weed-fs/src/pkg/directory/volume_mapping.go6
-rw-r--r--weed-fs/src/pkg/storage/store.go15
2 files changed, 9 insertions, 12 deletions
diff --git a/weed-fs/src/pkg/directory/volume_mapping.go b/weed-fs/src/pkg/directory/volume_mapping.go
index 114f212e2..0fb6c6a59 100644
--- a/weed-fs/src/pkg/directory/volume_mapping.go
+++ b/weed-fs/src/pkg/directory/volume_mapping.go
@@ -7,7 +7,7 @@ import (
"math/rand"
"os"
"path"
- "pkg/storage"
+ "pkg/topology"
"strconv"
"sync"
)
@@ -22,7 +22,7 @@ type MachineInfo struct {
}
type Machine struct {
Server MachineInfo
- Volumes []storage.VolumeInfo
+ Volumes []topology.VolumeInfo
}
type Mapper struct {
@@ -41,7 +41,7 @@ type Mapper struct {
volumeSizeLimit uint64
}
-func NewMachine(server, publicUrl string, volumes []storage.VolumeInfo) *Machine {
+func NewMachine(server, publicUrl string, volumes []topology.VolumeInfo) *Machine {
return &Machine{Server: MachineInfo{Url: server, PublicUrl: publicUrl}, Volumes: volumes}
}
diff --git a/weed-fs/src/pkg/storage/store.go b/weed-fs/src/pkg/storage/store.go
index e5cbd546b..93907c079 100644
--- a/weed-fs/src/pkg/storage/store.go
+++ b/weed-fs/src/pkg/storage/store.go
@@ -7,6 +7,7 @@ import (
"net/url"
"strconv"
"strings"
+ "pkg/topology"
"pkg/util"
)
@@ -16,10 +17,6 @@ type Store struct {
Port int
PublicUrl string
}
-type VolumeInfo struct {
- Id uint32
- Size int64
-}
func NewStore(port int, publicUrl, dirname string, volumeListString string) (s *Store) {
s = &Store{Port: port, PublicUrl: publicUrl, dir: dirname}
@@ -63,19 +60,19 @@ func (s *Store) addVolume(vid uint64) error {
s.volumes[vid] = NewVolume(s.dir, uint32(vid))
return nil
}
-func (s *Store) Status() *[]*VolumeInfo {
- stats := new([]*VolumeInfo)
+func (s *Store) Status() *[]*topology.VolumeInfo {
+ stats := new([]*topology.VolumeInfo)
for k, v := range s.volumes {
- s := new(VolumeInfo)
+ s := new(topology.VolumeInfo)
s.Id, s.Size = uint32(k), v.Size()
*stats = append(*stats, s)
}
return stats
}
func (s *Store) Join(mserver string) {
- stats := new([]*VolumeInfo)
+ stats := new([]*topology.VolumeInfo)
for k, v := range s.volumes {
- s := new(VolumeInfo)
+ s := new(topology.VolumeInfo)
s.Id, s.Size = uint32(k), v.Size()
*stats = append(*stats, s)
}