Merge pull request #650 from filecoin-project/feat/sector-improvements
sectors: Simple state restore
This commit is contained in:
commit
6b36f19a9d
@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -311,28 +310,6 @@ func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed Sea
|
|||||||
return proof, nil
|
return proof, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *SectorBuilder) SealStatus(sector uint64) (SectorSealingStatus, error) {
|
|
||||||
return sectorbuilder.GetSectorSealingStatusByID(sb.handle, sector)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sb *SectorBuilder) GetAllStagedSectors() ([]uint64, error) {
|
|
||||||
sectors, err := sectorbuilder.GetAllStagedSectors(sb.handle)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
out := make([]uint64, len(sectors))
|
|
||||||
for i, v := range sectors {
|
|
||||||
out[i] = v.SectorID
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Slice(out, func(i, j int) bool {
|
|
||||||
return out[i] < out[j]
|
|
||||||
})
|
|
||||||
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sb *SectorBuilder) GeneratePoSt(sectorInfo SortedSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
|
func (sb *SectorBuilder) GeneratePoSt(sectorInfo SortedSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
|
||||||
// Wait, this is a blocking method with no way of interrupting it?
|
// Wait, this is a blocking method with no way of interrupting it?
|
||||||
// does it checkpoint itself?
|
// does it checkpoint itself?
|
||||||
|
@ -124,8 +124,27 @@ func (t *SectorInfo) rspco() sectorbuilder.RawSealPreCommitOutput {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Miner) sectorStateLoop(ctx context.Context) {
|
func (m *Miner) sectorStateLoop(ctx context.Context) error {
|
||||||
// TODO: restore state
|
toRestart, err := m.ListSectors()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for _, si := range toRestart {
|
||||||
|
select {
|
||||||
|
case m.sectorUpdated <- sectorUpdate{
|
||||||
|
newState: si.State,
|
||||||
|
id: si.SectorID,
|
||||||
|
err: nil,
|
||||||
|
mut: nil,
|
||||||
|
}:
|
||||||
|
case <-ctx.Done():
|
||||||
|
log.Warn("didn't restart processing for all sectors: ", ctx.Err())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer log.Warn("quitting deal provider loop")
|
defer log.Warn("quitting deal provider loop")
|
||||||
@ -142,6 +161,8 @@ func (m *Miner) sectorStateLoop(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Miner) onSectorIncoming(sector *SectorInfo) {
|
func (m *Miner) onSectorIncoming(sector *SectorInfo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user