func (s *Storage) DeleteThumbnails(parentAttId string, blob tenpu.BlobStorage, meta tenpu.MetaStorage) (err error) { thumbs := s.ThumbnailByParentId(parentAttId) // log.Println("Delete thumbnail num:", len(thumbs)) var thumbAttIds []string for _, thumb := range thumbs { thumbAttIds = append(thumbAttIds, thumb.BodyId) } for _, thumbAttId := range thumbAttIds { err = blob.Delete(thumbAttId) if err != nil && err != mgo.ErrNotFound { return } err = meta.Remove(thumbAttId) if err != nil { return } } err = s.RemoveAll(parentAttId) return }