aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-07-19 20:38:00 -0700
committerChris Lu <chris.lu@gmail.com>2013-07-19 20:38:00 -0700
commit123b0cc2dfe32764651b02f08d5c9d7594434813 (patch)
treed45f162e64d604558252f0450cf00c6c7021431b /go
parentff1c04c4860e263c53ae62e7c08146c272e3f1c8 (diff)
downloadseaweedfs-123b0cc2dfe32764651b02f08d5c9d7594434813.tar.xz
seaweedfs-123b0cc2dfe32764651b02f08d5c9d7594434813.zip
fix for issue #35
Diffstat (limited to 'go')
-rw-r--r--go/storage/store.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/go/storage/store.go b/go/storage/store.go
index fcb9ce41c..a96602ed0 100644
--- a/go/storage/store.go
+++ b/go/storage/store.go
@@ -90,14 +90,18 @@ func (s *Store) findFreeLocation() (ret *DiskLocation) {
}
return ret
}
-func (s *Store) addVolume(vid VolumeId, replicationType ReplicationType) (err error) {
+func (s *Store) addVolume(vid VolumeId, replicationType ReplicationType) error {
if s.findVolume(vid) != nil {
return fmt.Errorf("Volume Id %s already exists!", vid)
}
if location := s.findFreeLocation(); location != nil {
log.Println("In dir", location.directory, "adds volume =", vid, ", replicationType =", replicationType)
- location.volumes[vid], err = NewVolume(location.directory, vid, replicationType)
- return err
+ if volume, err := NewVolume(location.directory, vid, replicationType); err == nil {
+ location.volumes[vid] = volume
+ return nil
+ } else {
+ return err
+ }
}
return fmt.Errorf("No more free space left")
}