Merge pull request #5016 from filecoin-project/fix/fsm-rm-unceroverable

storagefsm: Add missing planners
This commit is contained in:
Łukasz Magiera 2020-11-26 12:22:48 +01:00 committed by GitHub
commit 2304ea0077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 1 deletions

View File

@ -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},

View File

@ -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) {

View File

@ -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)
}
}

View File

@ -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