Merge pull request #10 from chrislusf/master

merge seaweed master
This commit is contained in:
joeslay
2019-10-14 16:03:40 +01:00
committed by GitHub
27 changed files with 1631 additions and 157 deletions

View File

@@ -59,6 +59,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
if alreadyHasSuperBlock {
e = v.readSuperBlock()
} else {
if !v.SuperBlock.Initialized() {
return fmt.Errorf("volume %s.dat not initialized", fileName)
}
e = v.maybeWriteSuperBlock()
}
if e == nil && alsoLoadIndex {

View File

@@ -71,6 +71,10 @@ func (s *SuperBlock) Bytes() []byte {
return header
}
func (s *SuperBlock) Initialized() bool {
return s.ReplicaPlacement != nil && s.Ttl != nil
}
func (v *Volume) maybeWriteSuperBlock() error {
mMap, exists := memory_map.FileMemoryMap[v.dataFile.Name()]