add exist sector state check
This commit is contained in:
parent
c9a8f3b8a0
commit
ed74091c20
@ -17,6 +17,8 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
|
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -420,6 +422,10 @@ var sectorsUpdateCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("could not parse sector number: %w", err)
|
return xerrors.Errorf("could not parse sector number: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, ok := sealing.ExistSectorStateList[sealing.SectorState(cctx.Args().Get(1))]; !ok {
|
||||||
|
return xerrors.Errorf("Not existing sector state")
|
||||||
|
}
|
||||||
|
|
||||||
return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1)))
|
return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1)))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
33
extern/storage-sealing/sector_state.go
vendored
33
extern/storage-sealing/sector_state.go
vendored
@ -2,6 +2,8 @@ package sealing
|
|||||||
|
|
||||||
type SectorState string
|
type SectorState string
|
||||||
|
|
||||||
|
var ExistSectorStateList = make(map[SectorState]struct{})
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UndefinedSectorState SectorState = ""
|
UndefinedSectorState SectorState = ""
|
||||||
|
|
||||||
@ -39,6 +41,37 @@ const (
|
|||||||
RemoveFailed SectorState = "RemoveFailed"
|
RemoveFailed SectorState = "RemoveFailed"
|
||||||
Removed SectorState = "Removed"
|
Removed SectorState = "Removed"
|
||||||
)
|
)
|
||||||
|
func init() {
|
||||||
|
ExistSectorStateList[Empty] = struct{}{}
|
||||||
|
ExistSectorStateList[WaitDeals] = struct{}{}
|
||||||
|
ExistSectorStateList[Packing] = struct{}{}
|
||||||
|
ExistSectorStateList[PreCommit1] = struct{}{}
|
||||||
|
ExistSectorStateList[PreCommit2] = struct{}{}
|
||||||
|
ExistSectorStateList[PreCommitting] = struct{}{}
|
||||||
|
ExistSectorStateList[PreCommitWait] = struct{}{}
|
||||||
|
ExistSectorStateList[WaitSeed] = struct{}{}
|
||||||
|
ExistSectorStateList[Committing] = struct{}{}
|
||||||
|
ExistSectorStateList[SubmitCommit] = struct{}{}
|
||||||
|
ExistSectorStateList[CommitWait] = struct{}{}
|
||||||
|
ExistSectorStateList[FinalizeSector] = struct{}{}
|
||||||
|
ExistSectorStateList[Proving] = struct{}{}
|
||||||
|
ExistSectorStateList[FailedUnrecoverable] = struct{}{}
|
||||||
|
ExistSectorStateList[SealPreCommit1Failed] = struct{}{}
|
||||||
|
ExistSectorStateList[SealPreCommit2Failed] = struct{}{}
|
||||||
|
ExistSectorStateList[PreCommitFailed] = struct{}{}
|
||||||
|
ExistSectorStateList[ComputeProofFailed] = struct{}{}
|
||||||
|
ExistSectorStateList[CommitFailed] = struct{}{}
|
||||||
|
ExistSectorStateList[PackingFailed] = struct{}{}
|
||||||
|
ExistSectorStateList[FinalizeFailed] = struct{}{}
|
||||||
|
ExistSectorStateList[DealsExpired] = struct{}{}
|
||||||
|
ExistSectorStateList[RecoverDealIDs] = struct{}{}
|
||||||
|
ExistSectorStateList[Faulty] = struct{}{}
|
||||||
|
ExistSectorStateList[FaultReported] = struct{}{}
|
||||||
|
ExistSectorStateList[FaultedFinal] = struct{}{}
|
||||||
|
ExistSectorStateList[Removing] = struct{}{}
|
||||||
|
ExistSectorStateList[RemoveFailed] = struct{}{}
|
||||||
|
ExistSectorStateList[Removed] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
func toStatState(st SectorState) statSectorState {
|
func toStatState(st SectorState) statSectorState {
|
||||||
switch st {
|
switch st {
|
||||||
|
Loading…
Reference in New Issue
Block a user