Add new event for start of CC sectors
This commit is contained in:
parent
5ad33896cc
commit
db863a4de7
5
fsm.go
5
fsm.go
@ -34,7 +34,10 @@ func (m *Sealing) Plan(events []statemachine.Event, user interface{}) (interface
|
||||
var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *SectorInfo) error{
|
||||
// Sealing
|
||||
|
||||
UndefinedSectorState: planOne(on(SectorStart{}, Packing)),
|
||||
UndefinedSectorState: planOne(
|
||||
on(SectorStart{}, Packing),
|
||||
on(SectorStartCC{}, Packing),
|
||||
),
|
||||
Packing: planOne(on(SectorPacked{}, PreCommit1)),
|
||||
PreCommit1: planOne(
|
||||
on(SectorPreCommit1{}, PreCommit2),
|
||||
|
@ -59,6 +59,18 @@ func (evt SectorStart) apply(state *SectorInfo) {
|
||||
state.SectorType = evt.SectorType
|
||||
}
|
||||
|
||||
type SectorStartCC struct {
|
||||
ID abi.SectorNumber
|
||||
SectorType abi.RegisteredSealProof
|
||||
Pieces []Piece
|
||||
}
|
||||
|
||||
func (evt SectorStartCC) apply(state *SectorInfo) {
|
||||
state.SectorNumber = evt.ID
|
||||
state.Pieces = evt.Pieces
|
||||
state.SectorType = evt.SectorType
|
||||
}
|
||||
|
||||
type SectorPacked struct{ FillerPieces []abi.PieceInfo }
|
||||
|
||||
func (evt SectorPacked) apply(state *SectorInfo) {
|
||||
|
@ -77,7 +77,7 @@ func (m *Sealing) PledgeSector() error {
|
||||
}
|
||||
}
|
||||
|
||||
if err := m.newSector(sid, rt, ps); err != nil {
|
||||
if err := m.newSectorCC(sid, rt, ps); err != nil {
|
||||
log.Errorf("%+v", err)
|
||||
return
|
||||
}
|
||||
|
20
sealing.go
20
sealing.go
@ -130,11 +130,13 @@ func (m *Sealing) SealPiece(ctx context.Context, size abi.UnpaddedPieceSize, r i
|
||||
})
|
||||
}
|
||||
|
||||
// newSector accepts a slice of pieces which will have a deal associated with
|
||||
// them (in the event of a storage deal) or no deal (in the event of sealing
|
||||
// garbage data)
|
||||
func (m *Sealing) Remove(ctx context.Context, sid abi.SectorNumber) error {
|
||||
return m.sectors.Send(uint64(sid), SectorRemove{})
|
||||
}
|
||||
|
||||
// newSector accepts a slice of pieces which will have deals associated with
|
||||
func (m *Sealing) newSector(sid abi.SectorNumber, rt abi.RegisteredSealProof, pieces []Piece) error {
|
||||
log.Infof("Start sealing %d", sid)
|
||||
log.Infof("Creating sector %d", sid)
|
||||
return m.sectors.Send(uint64(sid), SectorStart{
|
||||
ID: sid,
|
||||
Pieces: pieces,
|
||||
@ -142,8 +144,14 @@ func (m *Sealing) newSector(sid abi.SectorNumber, rt abi.RegisteredSealProof, pi
|
||||
})
|
||||
}
|
||||
|
||||
func (m *Sealing) Remove(ctx context.Context, sid abi.SectorNumber) error {
|
||||
return m.sectors.Send(uint64(sid), SectorRemove{})
|
||||
// newSectorCC accepts a slice of pieces with no deal (junk data)
|
||||
func (m *Sealing) newSectorCC(sid abi.SectorNumber, rt abi.RegisteredSealProof, pieces []Piece) error {
|
||||
log.Infof("Creating CC sector %d", sid)
|
||||
return m.sectors.Send(uint64(sid), SectorStartCC{
|
||||
ID: sid,
|
||||
Pieces: pieces,
|
||||
SectorType: rt,
|
||||
})
|
||||
}
|
||||
|
||||
func (m *Sealing) minerSector(num abi.SectorNumber) abi.SectorID {
|
||||
|
Loading…
Reference in New Issue
Block a user