simplified to one machine per volume

git-svn-id: https://weed-fs.googlecode.com/svn/trunk@14 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
chris.lu@gmail.com
2011-12-18 07:22:04 +00:00
parent 1fed603df9
commit 2c7a4eea1f
5 changed files with 104 additions and 81 deletions

View File

@@ -16,9 +16,9 @@ type Store struct {
Port int
PublicServer string
}
type VolumeStat struct {
Id uint64 "id"
CanWrite bool
type VolumeInfo struct {
Id uint64
Size int64
}
func NewStore(port int, publicServer, dirname string, chunkSize, capacity int) (s *Store) {
@@ -44,10 +44,10 @@ func NewStore(port int, publicServer, dirname string, chunkSize, capacity int) (
}
func (s *Store) Join(mserver string) {
stats := new([]*VolumeStat)
for k, _ := range s.volumes {
s := new(VolumeStat)
s.Id, s.CanWrite = k, true
stats := new([]*VolumeInfo)
for k, v := range s.volumes {
s := new(VolumeInfo)
s.Id, s.Size = k, v.Size()
*stats = append(*stats, s)
}
bytes, _ := json.Marshal(stats)