lotus/extern/sector-storage/sealtasks/task.go

58 lines
1.2 KiB
Go
Raw Normal View History

2020-03-23 11:40:02 +00:00
package sealtasks
type TaskType string
const (
TTAddPiece TaskType = "seal/v0/addpiece"
TTPreCommit1 TaskType = "seal/v0/precommit/1"
TTPreCommit2 TaskType = "seal/v0/precommit/2"
TTCommit1 TaskType = "seal/v0/commit/1" // NOTE: We use this to transfer the sector into miner-local storage for now; Don't use on workers!
TTCommit2 TaskType = "seal/v0/commit/2"
TTFinalize TaskType = "seal/v0/finalize"
2020-04-27 12:55:37 +00:00
2020-05-14 01:01:38 +00:00
TTFetch TaskType = "seal/v0/fetch"
TTUnseal TaskType = "seal/v0/unseal"
TTReadUnsealed TaskType = "seal/v0/unsealread"
2020-03-23 11:40:02 +00:00
)
2020-05-07 23:38:05 +00:00
var order = map[TaskType]int{
2020-05-14 01:01:38 +00:00
TTAddPiece: 7,
TTPreCommit1: 6,
TTPreCommit2: 5,
TTCommit2: 4,
TTCommit1: 3,
TTFetch: 2,
TTFinalize: 1,
TTUnseal: 0,
TTReadUnsealed: 0,
2020-05-07 23:38:05 +00:00
}
2020-07-21 18:01:25 +00:00
var shortNames = map[TaskType]string{
TTAddPiece: "AP ",
TTPreCommit1: "PC1",
TTPreCommit2: "PC2",
TTCommit1: "C1 ",
TTCommit2: "C2 ",
TTFinalize: "FIN",
TTFetch: "GET",
TTUnseal: "UNS",
TTReadUnsealed: "RD ",
}
2020-05-07 23:38:05 +00:00
func (a TaskType) Less(b TaskType) bool {
return order[a] < order[b]
}
2020-07-21 18:01:25 +00:00
func (a TaskType) Short() string {
n, ok := shortNames[a]
if !ok {
return "UNK"
}
return n
}