Indicate whether a sector has been marked for upgrade

This commit is contained in:
Aayush Rajasekaran 2020-08-21 15:43:30 -04:00
parent bf98ebe33e
commit 984e52acbc
5 changed files with 25 additions and 11 deletions

View File

@ -120,15 +120,16 @@ type SectorLog struct {
}
type SectorInfo struct {
SectorID abi.SectorNumber
State SectorState
CommD *cid.Cid
CommR *cid.Cid
Proof []byte
Deals []abi.DealID
Ticket SealTicket
Seed SealSeed
Retries uint64
SectorID abi.SectorNumber
State SectorState
CommD *cid.Cid
CommR *cid.Cid
Proof []byte
Deals []abi.DealID
Ticket SealTicket
Seed SealSeed
Retries uint64
ToUpgrade bool
LastErr string

View File

@ -192,7 +192,7 @@ var sectorsListCmd = &cli.Command{
_, inSSet := commitedIDs[s]
_, inASet := activeIDs[s]
fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\n",
fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\t toUpgrade:%t\n",
s,
st.State,
yesno(inSSet),
@ -200,6 +200,7 @@ var sectorsListCmd = &cli.Command{
st.Ticket.Epoch,
st.Seed.Epoch,
st.Deals,
st.ToUpgrade,
)
}

View File

@ -10,6 +10,13 @@ import (
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
)
func (m *Sealing) IsMarkedForUpgrade(id abi.SectorNumber) bool {
m.upgradeLk.Lock()
_, found := m.toUpgrade[id]
m.upgradeLk.Unlock()
return found
}
func (m *Sealing) MarkForUpgrade(id abi.SectorNumber) error {
m.upgradeLk.Lock()
defer m.upgradeLk.Unlock()

View File

@ -153,7 +153,8 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb
Value: info.SeedValue,
Epoch: info.SeedEpoch,
},
Retries: info.InvalidProofs,
Retries: info.InvalidProofs,
ToUpgrade: sm.Miner.IsMarkedForUpgrade(sid),
LastErr: info.LastErr,
Log: log,

View File

@ -47,3 +47,7 @@ func (m *Miner) RemoveSector(ctx context.Context, id abi.SectorNumber) error {
func (m *Miner) MarkForUpgrade(id abi.SectorNumber) error {
return m.sealing.MarkForUpgrade(id)
}
func (m *Miner) IsMarkedForUpgrade(id abi.SectorNumber) bool {
return m.sealing.IsMarkedForUpgrade(id)
}