panic on unknown pathType

This commit is contained in:
Anton Evangelatov 2021-05-11 18:14:01 +02:00
parent e07438417c
commit eb13c74dce

View File

@ -3,7 +3,7 @@ package stores
import (
"context"
"errors"
"math"
"fmt"
"net/url"
gopath "path"
"sort"
@ -385,12 +385,14 @@ func (i *Index) StorageBestAlloc(ctx context.Context, allocate storiface.SectorF
var candidates []storageEntry
var err error
spaceReq := uint64(math.MaxUint64)
var spaceReq uint64
switch pathType {
case storiface.PathSealing:
spaceReq, err = allocate.SealSpaceUse(ssize)
case storiface.PathStorage:
spaceReq, err = allocate.StoreSpaceUse(ssize)
default:
panic(fmt.Sprintf("unexpected pathType: %s", pathType))
}
if err != nil {
return nil, xerrors.Errorf("estimating required space: %w", err)