now working for registering volume id ~ machine mapping

git-svn-id: https://weed-fs.googlecode.com/svn/trunk@13 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
chris.lu@gmail.com 2011-12-17 06:50:51 +00:00
parent 10930ce6b6
commit 1fed603df9

View file

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