Browse Source

now working for registering volume id ~ machine mapping

git-svn-id: https://weed-fs.googlecode.com/svn/trunk@13 282b0af5-e82d-9cf1-ede4-77906d7719d0
pull/2/head
chris.lu@gmail.com 13 years ago
parent
commit
1fed603df9
  1. 4
      weed-fs/src/pkg/directory/volume_mapping.go

4
weed-fs/src/pkg/directory/volume_mapping.go

@ -39,7 +39,8 @@ func NewMapper(dirname string, filename string, capacity int) (m *Mapper) {
log.Println("Mapping File Read", e) log.Println("Mapping File Read", e)
} else { } else {
decoder := gob.NewDecoder(dataFile) decoder := gob.NewDecoder(dataFile)
decoder.Decode(m.Machines)
defer dataFile.Close()
decoder.Decode(&m.Machines)
for _, list := range m.Machines { for _, list := range m.Machines {
//TODO: what if a list has mixed readers and writers? Now it's treated as readonly //TODO: what if a list has mixed readers and writers? Now it's treated as readonly
allCanWrite := false allCanWrite := false
@ -50,7 +51,6 @@ func NewMapper(dirname string, filename string, capacity int) (m *Mapper) {
m.writers = append(m.writers, list) m.writers = append(m.writers, list)
} }
} }
dataFile.Close()
log.Println("Loaded mapping size", len(m.Machines)) log.Println("Loaded mapping size", len(m.Machines))
} }
return return

Loading…
Cancel
Save