remove api dependency on sealing fsm package

This commit is contained in:
Jeromy 2020-04-23 15:33:59 -07:00
parent 309f54aa0c
commit f4948dcba0
6 changed files with 21 additions and 17 deletions

View File

@ -13,7 +13,6 @@ import (
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/storage-fsm"
)
// StorageMiner is a low-level interface to the Filecoin network storage miner node
@ -37,7 +36,7 @@ type StorageMiner interface {
SectorsRefs(context.Context) (map[string][]SealedRef, error)
SectorsUpdate(context.Context, abi.SectorNumber, sealing.SectorState) error
SectorsUpdate(context.Context, abi.SectorNumber, SectorState) error
StorageList(ctx context.Context) (map[stores.ID][]stores.Decl, error)
StorageLocal(ctx context.Context) (map[stores.ID]string, error)
@ -78,7 +77,7 @@ type SectorLog struct {
type SectorInfo struct {
SectorID abi.SectorNumber
State sealing.SectorState
State SectorState
CommD *cid.Cid
CommR *cid.Cid
Proof []byte
@ -119,3 +118,5 @@ func (st *SealTicket) Equals(ost *SealTicket) bool {
func (st *SealSeed) Equals(ost *SealSeed) bool {
return bytes.Equal(st.Value, ost.Value) && st.Epoch == ost.Epoch
}
type SectorState string

View File

@ -23,7 +23,6 @@ import (
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/node/modules/dtypes"
sealing "github.com/filecoin-project/storage-fsm"
)
// All permissions are listed in permissioned.go
@ -184,10 +183,10 @@ type StorageMinerStruct struct {
PledgeSector func(context.Context) error `perm:"write"`
SectorsStatus func(context.Context, abi.SectorNumber) (api.SectorInfo, error) `perm:"read"`
SectorsList func(context.Context) ([]abi.SectorNumber, error) `perm:"read"`
SectorsRefs func(context.Context) (map[string][]api.SealedRef, error) `perm:"read"`
SectorsUpdate func(context.Context, abi.SectorNumber, sealing.SectorState) error `perm:"write"`
SectorsStatus func(context.Context, abi.SectorNumber) (api.SectorInfo, error) `perm:"read"`
SectorsList func(context.Context) ([]abi.SectorNumber, error) `perm:"read"`
SectorsRefs func(context.Context) (map[string][]api.SealedRef, error) `perm:"read"`
SectorsUpdate func(context.Context, abi.SectorNumber, api.SectorState) error `perm:"write"`
WorkerConnect func(context.Context, string) error `perm:"admin"` // TODO: worker perm
WorkerStats func(context.Context) (map[uint64]storiface.WorkerStats, error) `perm:"admin"`
@ -689,7 +688,7 @@ func (c *StorageMinerStruct) SectorsRefs(ctx context.Context) (map[string][]api.
return c.Internal.SectorsRefs(ctx)
}
func (c *StorageMinerStruct) SectorsUpdate(ctx context.Context, id abi.SectorNumber, state sealing.SectorState) error {
func (c *StorageMinerStruct) SectorsUpdate(ctx context.Context, id abi.SectorNumber, state api.SectorState) error {
return c.Internal.SectorsUpdate(ctx, id, state)
}

View File

@ -142,7 +142,7 @@ func sectorsInfo(ctx context.Context, napi api.StorageMiner) (map[sealing.Sector
return nil, err
}
out[st.State]++
out[sealing.SectorState(st.State)]++
}
return out, nil

View File

@ -13,9 +13,9 @@ import (
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli"
sealing "github.com/filecoin-project/storage-fsm"
)
var sectorsCmd = &cli.Command{
@ -236,7 +236,7 @@ var sectorsUpdateCmd = &cli.Command{
return xerrors.Errorf("could not parse sector ID: %w", err)
}
return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), sealing.SectorState(cctx.Args().Get(1)))
return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1)))
},
}

View File

@ -183,7 +183,11 @@ func (c *client) makeOutChan(ctx context.Context, ftyp reflect.Type, valOut int)
buf.PushBack(val)
if buf.Len() > 1 {
log.Warnw("rpc output message buffer", "n", buf.Len())
if buf.Len() > 10 {
log.Warnw("rpc output message buffer", "n", buf.Len())
} else {
log.Infow("rpc output message buffer", "n", buf.Len())
}
bufLk.Unlock()
return
}

View File

@ -17,6 +17,7 @@ import (
"github.com/filecoin-project/sector-storage/stores"
"github.com/filecoin-project/sector-storage/storiface"
"github.com/filecoin-project/specs-actors/actors/abi"
sealing "github.com/filecoin-project/storage-fsm"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/apistruct"
@ -25,7 +26,6 @@ import (
"github.com/filecoin-project/lotus/node/impl/common"
"github.com/filecoin-project/lotus/storage"
"github.com/filecoin-project/lotus/storage/sectorblocks"
sealing "github.com/filecoin-project/storage-fsm"
)
type StorageMinerAPI struct {
@ -106,7 +106,7 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb
return api.SectorInfo{
SectorID: sid,
State: info.State,
State: api.SectorState(info.State),
CommD: info.CommD,
CommR: info.CommR,
Proof: info.Proof,
@ -164,8 +164,8 @@ func (sm *StorageMinerAPI) StorageStat(ctx context.Context, id stores.ID) (store
return sm.StorageMgr.FsStat(ctx, id)
}
func (sm *StorageMinerAPI) SectorsUpdate(ctx context.Context, id abi.SectorNumber, state sealing.SectorState) error {
return sm.Miner.ForceSectorState(ctx, id, state)
func (sm *StorageMinerAPI) SectorsUpdate(ctx context.Context, id abi.SectorNumber, state api.SectorState) error {
return sm.Miner.ForceSectorState(ctx, id, sealing.SectorState(state))
}
func (sm *StorageMinerAPI) WorkerConnect(ctx context.Context, url string) error {