panic on unknown pathType
This commit is contained in:
parent
e07438417c
commit
eb13c74dce
6
extern/sector-storage/stores/index.go
vendored
6
extern/sector-storage/stores/index.go
vendored
@ -3,7 +3,7 @@ package stores
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"math"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
gopath "path"
|
gopath "path"
|
||||||
"sort"
|
"sort"
|
||||||
@ -385,12 +385,14 @@ func (i *Index) StorageBestAlloc(ctx context.Context, allocate storiface.SectorF
|
|||||||
var candidates []storageEntry
|
var candidates []storageEntry
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
spaceReq := uint64(math.MaxUint64)
|
var spaceReq uint64
|
||||||
switch pathType {
|
switch pathType {
|
||||||
case storiface.PathSealing:
|
case storiface.PathSealing:
|
||||||
spaceReq, err = allocate.SealSpaceUse(ssize)
|
spaceReq, err = allocate.SealSpaceUse(ssize)
|
||||||
case storiface.PathStorage:
|
case storiface.PathStorage:
|
||||||
spaceReq, err = allocate.StoreSpaceUse(ssize)
|
spaceReq, err = allocate.StoreSpaceUse(ssize)
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unexpected pathType: %s", pathType))
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("estimating required space: %w", err)
|
return nil, xerrors.Errorf("estimating required space: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user