Merge pull request #5016 from filecoin-project/fix/fsm-rm-unceroverable
storagefsm: Add missing planners
This commit is contained in:
commit
2304ea0077
@ -253,6 +253,7 @@ var stateList = []stateMeta{
|
||||
|
||||
{col: color.FgRed, state: sealing.UndefinedSectorState},
|
||||
{col: color.FgYellow, state: sealing.Packing},
|
||||
{col: color.FgYellow, state: sealing.GetTicket},
|
||||
{col: color.FgYellow, state: sealing.PreCommit1},
|
||||
{col: color.FgYellow, state: sealing.PreCommit2},
|
||||
{col: color.FgYellow, state: sealing.PreCommitting},
|
||||
|
4
extern/storage-sealing/fsm.go
vendored
4
extern/storage-sealing/fsm.go
vendored
@ -159,8 +159,12 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
|
||||
on(SectorFaultReported{}, FaultReported),
|
||||
),
|
||||
|
||||
FaultReported: final, // not really supported right now
|
||||
|
||||
FaultedFinal: final,
|
||||
Removed: final,
|
||||
|
||||
FailedUnrecoverable: final,
|
||||
}
|
||||
|
||||
func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(statemachine.Context, SectorInfo) error, uint64, error) {
|
||||
|
15
extern/storage-sealing/fsm_test.go
vendored
15
extern/storage-sealing/fsm_test.go
vendored
@ -160,3 +160,18 @@ func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) {
|
||||
|
||||
require.Equal(t, CommitFailed, m.state.State)
|
||||
}
|
||||
|
||||
func TestPlannerList(t *testing.T) {
|
||||
for state := range ExistSectorStateList {
|
||||
_, ok := fsmPlanners[state]
|
||||
require.True(t, ok, "state %s", state)
|
||||
}
|
||||
|
||||
for state := range fsmPlanners {
|
||||
if state == UndefinedSectorState {
|
||||
continue
|
||||
}
|
||||
_, ok := ExistSectorStateList[state]
|
||||
require.True(t, ok, "state %s", state)
|
||||
}
|
||||
}
|
||||
|
3
extern/storage-sealing/sector_state.go
vendored
3
extern/storage-sealing/sector_state.go
vendored
@ -6,6 +6,7 @@ var ExistSectorStateList = map[SectorState]struct{}{
|
||||
Empty: {},
|
||||
WaitDeals: {},
|
||||
Packing: {},
|
||||
GetTicket: {},
|
||||
PreCommit1: {},
|
||||
PreCommit2: {},
|
||||
PreCommitting: {},
|
||||
@ -75,7 +76,7 @@ const (
|
||||
|
||||
func toStatState(st SectorState) statSectorState {
|
||||
switch st {
|
||||
case Empty, WaitDeals, Packing, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, CommitWait, FinalizeSector:
|
||||
case Empty, WaitDeals, Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, SubmitCommit, CommitWait, FinalizeSector:
|
||||
return sstSealing
|
||||
case Proving, Removed, Removing:
|
||||
return sstProving
|
||||
|
Loading…
Reference in New Issue
Block a user