Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>

fix merge error
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
This commit is contained in:
Jiaying Wang 2022-04-12 14:53:19 +02:00 committed by jennijuju
parent 137f494619
commit 1fc94e33b2
3 changed files with 0 additions and 119 deletions

View File

@ -7,7 +7,6 @@ import (
"net/url"
gopath "path"
"sort"
"strings"
"sync"
"time"
@ -26,62 +25,6 @@ import (
var HeartbeatInterval = 10 * time.Second
var SkippedHeartbeatThresh = HeartbeatInterval * 5
// ID identifies sector storage by UUID. One sector storage should map to one
// filesystem, local or networked / shared by multiple machines
type ID string
const IDSep = "."
type IDList []ID
func (il IDList) String() string {
l := make([]string, len(il))
for i, id := range il {
l[i] = string(id)
}
return strings.Join(l, IDSep)
}
func ParseIDList(s string) IDList {
strs := strings.Split(s, IDSep)
out := make([]ID, len(strs))
for i, str := range strs {
out[i] = ID(str)
}
return out
}
type Group = string
type StorageInfo struct {
ID ID
URLs []string // TODO: Support non-http transports
Weight uint64
MaxStorage uint64
CanSeal bool
CanStore bool
Groups []Group
AllowTo []Group
}
type HealthReport struct {
Stat fsutil.FsStat
Err string
}
type SectorStorageInfo struct {
ID ID
URLs []string // TODO: Support non-http transports
Weight uint64
CanSeal bool
CanStore bool
Primary bool
}
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/index.go -package=mocks . SectorIndex
type SectorIndex interface { // part of storage-miner api

View File

@ -108,8 +108,6 @@ type Sealing struct {
assignedPieces map[abi.SectorID][]cid.Cid
nextDealSector *abi.SectorNumber // used to prevent a race where we could create a new sector more than once
upgradeLk sync.Mutex
toUpgrade map[abi.SectorNumber]struct{}
available map[abi.SectorID]struct{}
notifee SectorStateNotifee

View File

@ -6,9 +6,6 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
)
@ -59,60 +56,3 @@ func (m *Sealing) sectorActive(ctx context.Context, tok TipSetToken, sector abi.
return active.IsSet(uint64(sector))
}
func (m *Sealing) tryUpgradeSector(ctx context.Context, params *miner.SectorPreCommitInfo) big.Int {
if len(params.DealIDs) == 0 {
return big.Zero()
}
replace := m.maybeUpgradableSector()
if replace != nil {
loc, err := m.Api.StateSectorPartition(ctx, m.maddr, *replace, nil)
if err != nil {
log.Errorf("error calling StateSectorPartition for replaced sector: %+v", err)
return big.Zero()
}
params.ReplaceCapacity = true
params.ReplaceSectorNumber = *replace
params.ReplaceSectorDeadline = loc.Deadline
params.ReplaceSectorPartition = loc.Partition
log.Infof("replacing sector %d with %d", *replace, params.SectorNumber)
ri, err := m.Api.StateSectorGetInfo(ctx, m.maddr, *replace, nil)
if err != nil {
log.Errorf("error calling StateSectorGetInfo for replaced sector: %+v", err)
return big.Zero()
}
if ri == nil {
log.Errorf("couldn't find sector info for sector to replace: %+v", replace)
return big.Zero()
}
if params.Expiration < ri.Expiration {
// TODO: Some limit on this
params.Expiration = ri.Expiration
}
return ri.InitialPledge
}
return big.Zero()
}
func (m *Sealing) maybeUpgradableSector() *abi.SectorNumber {
m.upgradeLk.Lock()
defer m.upgradeLk.Unlock()
for number := range m.toUpgrade {
// TODO: checks to match actor constraints
// this one looks good
/*if checks */
{
delete(m.toUpgrade, number)
return &number
}
}
return nil
}