From d5af25b76cba60d0aceb94ab395d5df9ebee1428 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 17 Sep 2020 10:38:07 +0800 Subject: [PATCH] update init sector state list --- cmd/lotus-storage-miner/sectors.go | 4 +- extern/storage-sealing/sector_state.go | 63 +++++++++++++------------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/cmd/lotus-storage-miner/sectors.go b/cmd/lotus-storage-miner/sectors.go index c08d6ca14..1b5cfb676 100644 --- a/cmd/lotus-storage-miner/sectors.go +++ b/cmd/lotus-storage-miner/sectors.go @@ -17,9 +17,9 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" - - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + lcli "github.com/filecoin-project/lotus/cli" + sealing "github.com/filecoin-project/lotus/extern/storage-sealing" ) var sectorsCmd = &cli.Command{ diff --git a/extern/storage-sealing/sector_state.go b/extern/storage-sealing/sector_state.go index 3ed891064..10b96e504 100644 --- a/extern/storage-sealing/sector_state.go +++ b/extern/storage-sealing/sector_state.go @@ -2,7 +2,37 @@ package sealing type SectorState string -var ExistSectorStateList = make(map[SectorState]struct{}) +var ExistSectorStateList = map[SectorState]struct{}{ + Empty: {}, + WaitDeals: {}, + Packing: {}, + PreCommit1: {}, + PreCommit2: {}, + PreCommitting: {}, + PreCommitWait: {}, + WaitSeed: {}, + Committing: {}, + SubmitCommit: {}, + CommitWait: {}, + FinalizeSector: {}, + Proving: {}, + FailedUnrecoverable: {}, + SealPreCommit1Failed: {}, + SealPreCommit2Failed: {}, + PreCommitFailed: {}, + ComputeProofFailed: {}, + CommitFailed: {}, + PackingFailed: {}, + FinalizeFailed: {}, + DealsExpired: {}, + RecoverDealIDs: {}, + Faulty: {}, + FaultReported: {}, + FaultedFinal: {}, + Removing: {}, + RemoveFailed: {}, + Removed: {}, +} const ( UndefinedSectorState SectorState = "" @@ -41,37 +71,6 @@ const ( RemoveFailed SectorState = "RemoveFailed" 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 { switch st {