lotus/storage/pipeline/sector_state.go

203 lines
7.9 KiB
Go
Raw Normal View History

package sealing
2020-04-06 20:23:37 +00:00
type SectorState string
2020-09-17 02:38:07 +00:00
var ExistSectorStateList = map[SectorState]struct{}{
2022-03-02 16:33:33 +00:00
Empty: {},
WaitDeals: {},
Packing: {},
AddPiece: {},
AddPieceFailed: {},
GetTicket: {},
PreCommit1: {},
PreCommit2: {},
PreCommitting: {},
PreCommitWait: {},
SubmitPreCommitBatch: {},
PreCommitBatchWait: {},
WaitSeed: {},
Committing: {},
CommitFinalize: {},
CommitFinalizeFailed: {},
SubmitCommit: {},
CommitWait: {},
SubmitCommitAggregate: {},
CommitAggregateWait: {},
FinalizeSector: {},
Proving: {},
2022-03-16 16:33:05 +00:00
Available: {},
2022-03-02 16:33:33 +00:00
FailedUnrecoverable: {},
SealPreCommit1Failed: {},
SealPreCommit2Failed: {},
PreCommitFailed: {},
ComputeProofFailed: {},
2022-09-09 10:54:48 +00:00
RemoteCommitFailed: {},
2022-03-02 16:33:33 +00:00
CommitFailed: {},
PackingFailed: {},
FinalizeFailed: {},
DealsExpired: {},
RecoverDealIDs: {},
Faulty: {},
FaultReported: {},
FaultedFinal: {},
Terminating: {},
TerminateWait: {},
TerminateFinality: {},
TerminateFailed: {},
Removing: {},
RemoveFailed: {},
Removed: {},
SnapDealsWaitDeals: {},
SnapDealsAddPiece: {},
SnapDealsPacking: {},
UpdateReplica: {},
ProveReplicaUpdate: {},
SubmitReplicaUpdate: {},
2022-11-07 14:56:53 +00:00
WaitMutable: {},
2022-03-02 16:33:33 +00:00
ReplicaUpdateWait: {},
UpdateActivating: {},
ReleaseSectorKey: {},
FinalizeReplicaUpdate: {},
SnapDealsAddPieceFailed: {},
SnapDealsDealsExpired: {},
SnapDealsRecoverDealIDs: {},
ReplicaUpdateFailed: {},
ReleaseSectorKeyFailed: {},
FinalizeReplicaUpdateFailed: {},
AbortUpgrade: {},
ReceiveSector: {},
2020-09-17 02:38:07 +00:00
}
2020-09-16 11:49:45 +00:00
// cmd/lotus-miner/info.go defines CLI colors corresponding to these states
// update files there when adding new states
const (
2020-04-06 20:23:37 +00:00
UndefinedSectorState SectorState = ""
// happy path
2021-05-18 15:21:10 +00:00
Empty SectorState = "Empty" // deprecated
WaitDeals SectorState = "WaitDeals" // waiting for more pieces (deals) to be added to the sector
AddPiece SectorState = "AddPiece" // put deal data (and padding if required) into the sector
Packing SectorState = "Packing" // sector not in sealStore, and not on chain
GetTicket SectorState = "GetTicket" // generate ticket
PreCommit1 SectorState = "PreCommit1" // do PreCommit1
PreCommit2 SectorState = "PreCommit2" // do PreCommit2
PreCommitting SectorState = "PreCommitting" // on chain pre-commit (deprecated)
2021-03-10 15:16:44 +00:00
PreCommitWait SectorState = "PreCommitWait" // waiting for precommit to land on chain
2021-05-18 15:21:10 +00:00
SubmitPreCommitBatch SectorState = "SubmitPreCommitBatch"
PreCommitBatchWait SectorState = "PreCommitBatchWait"
WaitSeed SectorState = "WaitSeed" // waiting for seed
Committing SectorState = "Committing" // compute PoRep
CommitFinalize SectorState = "CommitFinalize" // cleanup sector metadata before submitting the proof (early finalize)
CommitFinalizeFailed SectorState = "CommitFinalizeFailed"
2021-03-10 15:16:44 +00:00
// single commit
SubmitCommit SectorState = "SubmitCommit" // send commit message to the chain
CommitWait SectorState = "CommitWait" // wait for the commit message to land on chain
SubmitCommitAggregate SectorState = "SubmitCommitAggregate"
CommitAggregateWait SectorState = "CommitAggregateWait"
2020-04-06 20:23:37 +00:00
FinalizeSector SectorState = "FinalizeSector"
Proving SectorState = "Proving"
2022-03-16 16:33:05 +00:00
Available SectorState = "Available" // proving CC available for SnapDeals
// snap deals / cc update
SnapDealsWaitDeals SectorState = "SnapDealsWaitDeals"
SnapDealsAddPiece SectorState = "SnapDealsAddPiece"
SnapDealsPacking SectorState = "SnapDealsPacking"
UpdateReplica SectorState = "UpdateReplica"
ProveReplicaUpdate SectorState = "ProveReplicaUpdate"
SubmitReplicaUpdate SectorState = "SubmitReplicaUpdate"
2022-11-07 14:56:53 +00:00
WaitMutable SectorState = "WaitMutable"
ReplicaUpdateWait SectorState = "ReplicaUpdateWait"
FinalizeReplicaUpdate SectorState = "FinalizeReplicaUpdate"
UpdateActivating SectorState = "UpdateActivating"
ReleaseSectorKey SectorState = "ReleaseSectorKey"
// external import
ReceiveSector SectorState = "ReceiveSector"
// error modes
FailedUnrecoverable SectorState = "FailedUnrecoverable"
AddPieceFailed SectorState = "AddPieceFailed"
SealPreCommit1Failed SectorState = "SealPreCommit1Failed"
SealPreCommit2Failed SectorState = "SealPreCommit2Failed"
PreCommitFailed SectorState = "PreCommitFailed"
ComputeProofFailed SectorState = "ComputeProofFailed"
2022-09-09 10:54:48 +00:00
RemoteCommitFailed SectorState = "RemoteCommitFailed"
CommitFailed SectorState = "CommitFailed"
PackingFailed SectorState = "PackingFailed" // TODO: deprecated, remove
FinalizeFailed SectorState = "FinalizeFailed"
DealsExpired SectorState = "DealsExpired"
RecoverDealIDs SectorState = "RecoverDealIDs"
2020-06-03 21:42:13 +00:00
// snap deals error modes
2022-03-02 16:33:33 +00:00
SnapDealsAddPieceFailed SectorState = "SnapDealsAddPieceFailed"
SnapDealsDealsExpired SectorState = "SnapDealsDealsExpired"
SnapDealsRecoverDealIDs SectorState = "SnapDealsRecoverDealIDs"
AbortUpgrade SectorState = "AbortUpgrade"
ReplicaUpdateFailed SectorState = "ReplicaUpdateFailed"
ReleaseSectorKeyFailed SectorState = "ReleaseSectorKeyFailed"
FinalizeReplicaUpdateFailed SectorState = "FinalizeReplicaUpdateFailed"
2020-06-03 21:42:13 +00:00
Faulty SectorState = "Faulty" // sector is corrupted or gone for some reason
FaultReported SectorState = "FaultReported" // sector has been declared as a fault on chain
FaultedFinal SectorState = "FaultedFinal" // fault declared on chain
2020-06-22 16:42:38 +00:00
2021-01-12 23:42:01 +00:00
Terminating SectorState = "Terminating"
TerminateWait SectorState = "TerminateWait"
TerminateFinality SectorState = "TerminateFinality"
TerminateFailed SectorState = "TerminateFailed"
2020-06-22 16:42:38 +00:00
Removing SectorState = "Removing"
RemoveFailed SectorState = "RemoveFailed"
Removed SectorState = "Removed"
)
func toStatState(st SectorState, finEarly bool) statSectorState {
switch st {
case UndefinedSectorState, Empty, WaitDeals, AddPiece, AddPieceFailed, SnapDealsWaitDeals, SnapDealsAddPiece:
2021-01-18 13:26:03 +00:00
return sstStaging
case Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, SubmitPreCommitBatch, PreCommitBatchWait, WaitSeed, Committing, CommitFinalize, FinalizeSector, SnapDealsPacking, UpdateReplica, ProveReplicaUpdate, FinalizeReplicaUpdate, ReceiveSector:
return sstSealing
2022-11-07 14:56:53 +00:00
case SubmitCommit, CommitWait, SubmitCommitAggregate, CommitAggregateWait, WaitMutable, SubmitReplicaUpdate, ReplicaUpdateWait:
if finEarly {
// we use statSectorState for throttling storage use. With FinalizeEarly
// we can consider sectors in states after CommitFinalize as finalized, so
// that more sectors can enter the sealing pipeline (and later be aggregated together)
return sstProving
}
return sstSealing
2022-03-16 16:33:05 +00:00
case Proving, Available, UpdateActivating, ReleaseSectorKey, Removed, Removing, Terminating, TerminateWait, TerminateFinality, TerminateFailed:
return sstProving
}
return sstFailed
}
func IsUpgradeState(st SectorState) bool {
switch st {
case SnapDealsWaitDeals,
SnapDealsAddPiece,
SnapDealsPacking,
UpdateReplica,
ProveReplicaUpdate,
SubmitReplicaUpdate,
2022-11-07 14:56:53 +00:00
WaitMutable,
SnapDealsAddPieceFailed,
SnapDealsDealsExpired,
SnapDealsRecoverDealIDs,
AbortUpgrade,
ReplicaUpdateFailed,
ReleaseSectorKeyFailed,
FinalizeReplicaUpdateFailed:
return true
default:
return false
}
}