Skip to content

Commit

Permalink
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
Browse files Browse the repository at this point in the history
fix merge error
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
  • Loading branch information
jennijuju committed Apr 12, 2022
1 parent 137f494 commit 1fc94e3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 119 deletions.
57 changes: 0 additions & 57 deletions extern/sector-storage/stores/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net/url"
gopath "path"
"sort"
"strings"
"sync"
"time"

Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions extern/storage-sealing/sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 0 additions & 60 deletions extern/storage-sealing/upgrade_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}

0 comments on commit 1fc94e3

Please sign in to comment.