75 lines
2.2 KiB
Go
75 lines
2.2 KiB
Go
|
package storage
|
||
|
|
||
|
import (
|
||
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||
|
|
||
|
"github.com/ipfs/go-cid"
|
||
|
)
|
||
|
|
||
|
// SchedulerState defines the possible states in which the scheduler could be,
|
||
|
// for the purposes of journalling.
|
||
|
type SchedulerState string
|
||
|
|
||
|
const (
|
||
|
// SchedulerStateStarted gets recorded when a WdPoSt cycle for an
|
||
|
// epoch begins.
|
||
|
SchedulerStateStarted = SchedulerState("started")
|
||
|
// SchedulerStateAborted gets recorded when a WdPoSt cycle for an
|
||
|
// epoch is aborted, normally because of a chain reorg or advancement.
|
||
|
SchedulerStateAborted = SchedulerState("aborted")
|
||
|
// SchedulerStateFaulted gets recorded when a WdPoSt cycle for an
|
||
|
// epoch terminates abnormally, in which case the error is also recorded.
|
||
|
SchedulerStateFaulted = SchedulerState("faulted")
|
||
|
// SchedulerStateSucceeded gets recorded when a WdPoSt cycle for an
|
||
|
// epoch ends successfully.
|
||
|
SchedulerStateSucceeded = SchedulerState("succeeded")
|
||
|
)
|
||
|
|
||
|
// Journal event types.
|
||
|
const (
|
||
|
evtTypeWdPoStScheduler = iota
|
||
|
evtTypeWdPoStProofs
|
||
|
evtTypeWdPoStRecoveries
|
||
|
evtTypeWdPoStFaults
|
||
|
)
|
||
|
|
||
|
// evtCommon is a common set of attributes for Windowed PoSt journal events.
|
||
|
type evtCommon struct {
|
||
|
Deadline *miner.DeadlineInfo
|
||
|
Height abi.ChainEpoch
|
||
|
TipSet []cid.Cid
|
||
|
Error error `json:",omitempty"`
|
||
|
}
|
||
|
|
||
|
// WdPoStSchedulerEvt is the journal event that gets recorded on scheduler
|
||
|
// actions.
|
||
|
type WdPoStSchedulerEvt struct {
|
||
|
evtCommon
|
||
|
State SchedulerState
|
||
|
}
|
||
|
|
||
|
// WdPoStProofsProcessedEvt is the journal event that gets recorded when
|
||
|
// Windowed PoSt proofs have been processed.
|
||
|
type WdPoStProofsProcessedEvt struct {
|
||
|
evtCommon
|
||
|
Partitions []miner.PoStPartition
|
||
|
MessageCID cid.Cid `json:",omitempty"`
|
||
|
}
|
||
|
|
||
|
// WdPoStRecoveriesProcessedEvt is the journal event that gets recorded when
|
||
|
// Windowed PoSt recoveries have been processed.
|
||
|
type WdPoStRecoveriesProcessedEvt struct {
|
||
|
evtCommon
|
||
|
Declarations []miner.RecoveryDeclaration
|
||
|
MessageCID cid.Cid `json:",omitempty"`
|
||
|
}
|
||
|
|
||
|
// WdPoStFaultsProcessedEvt is the journal event that gets recorded when
|
||
|
// Windowed PoSt faults have been processed.
|
||
|
type WdPoStFaultsProcessedEvt struct {
|
||
|
evtCommon
|
||
|
Declarations []miner.FaultDeclaration
|
||
|
MessageCID cid.Cid `json:",omitempty"`
|
||
|
}
|