add collection.delete

This commit is contained in:
Chris Lu
2019-05-30 09:47:54 -07:00
parent 1d111d6ce8
commit 40ca2f2903
5 changed files with 92 additions and 2 deletions

View File

@@ -114,17 +114,31 @@ func (l *DiskLocation) loadExistingVolumes(needleMapKind NeedleMapType) {
}
func (l *DiskLocation) DeleteCollectionFromDiskLocation(collection string) (e error) {
l.Lock()
defer l.Unlock()
l.Lock()
for k, v := range l.volumes {
if v.Collection == collection {
e = l.deleteVolumeById(k)
if e != nil {
l.Unlock()
return
}
}
}
l.Unlock()
l.ecVolumesLock.Lock()
for k, v := range l.ecVolumes {
if v.Collection == collection {
e = l.deleteEcVolumeById(k)
if e != nil {
l.ecVolumesLock.Unlock()
return
}
}
}
l.ecVolumesLock.Unlock()
return
}