Skip to content

Commit

Permalink
chore: Fix imports with '2' suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jun 14, 2022
1 parent 28099a3 commit a581d73
Show file tree
Hide file tree
Showing 14 changed files with 250 additions and 250 deletions.
68 changes: 34 additions & 34 deletions storage/adapter_storage_miner.go

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions storage/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/storage/ctladdr"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
)
Expand All @@ -52,15 +52,15 @@ type Miner struct {
feeCfg config.MinerFeeConfig
sealer sealer.SectorManager
ds datastore.Batching
sc sealing2.SectorIDCounter
sc pipeline.SectorIDCounter
verif ffiwrapper.Verifier
prover ffiwrapper.Prover
addrSel *ctladdr.AddressSelector

maddr address.Address

getSealConfig dtypes.GetSealingConfigFunc
sealing *sealing2.Sealing
sealing *pipeline.Sealing

sealingEvtType journal.EventType

Expand All @@ -71,8 +71,8 @@ type Miner struct {
type SealingStateEvt struct {
SectorNumber abi.SectorNumber
SectorType abi.RegisteredSealProof
From sealing2.SectorState
After sealing2.SectorState
From pipeline.SectorState
After pipeline.SectorState
Error string
}

Expand Down Expand Up @@ -134,7 +134,7 @@ func NewMiner(api fullNodeFilteredAPI,
maddr address.Address,
ds datastore.Batching,
sealer sealer.SectorManager,
sc sealing2.SectorIDCounter,
sc pipeline.SectorIDCounter,
verif ffiwrapper.Verifier,
prover ffiwrapper.Prover,
gsd dtypes.GetSealingConfigFunc,
Expand Down Expand Up @@ -185,26 +185,26 @@ func (m *Miner) Run(ctx context.Context) error {
adaptedAPI := NewSealingAPIAdapter(m.api)

// Instantiate a precommit policy.
cfg := sealing2.GetSealingConfigFunc(m.getSealConfig)
cfg := pipeline.GetSealingConfigFunc(m.getSealConfig)
provingBuffer := md.WPoStProvingPeriod * 2

pcp := sealing2.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer)
pcp := pipeline.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer)

// address selector.
as := func(ctx context.Context, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) {
return m.addrSel.AddressFor(ctx, m.api, mi, use, goodFunds, minFunds)
}

// Instantiate the sealing FSM.
m.sealing = sealing2.New(ctx, adaptedAPI, m.feeCfg, evtsAdapter, m.maddr, m.ds, m.sealer, m.sc, m.verif, m.prover, &pcp, cfg, m.handleSealingNotifications, as)
m.sealing = pipeline.New(ctx, adaptedAPI, m.feeCfg, evtsAdapter, m.maddr, m.ds, m.sealer, m.sc, m.verif, m.prover, &pcp, cfg, m.handleSealingNotifications, as)

// Run the sealing FSM.
go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function

return nil
}

func (m *Miner) handleSealingNotifications(before, after sealing2.SectorInfo) {
func (m *Miner) handleSealingNotifications(before, after pipeline.SectorInfo) {
m.journal.RecordEvent(m.sealingEvtType, func() interface{} {
return SealingStateEvt{
SectorNumber: before.SectorNumber,
Expand Down
6 changes: 3 additions & 3 deletions storage/miner_sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/filecoin-project/specs-storage/storage"

"github.com/filecoin-project/lotus/api"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
"github.com/filecoin-project/lotus/storage/sectorblocks"
)
Expand All @@ -27,15 +27,15 @@ func (m *Miner) StartPackingSector(sectorNum abi.SectorNumber) error {
return m.sealing.StartPacking(sectorNum)
}

func (m *Miner) ListSectors() ([]sealing2.SectorInfo, error) {
func (m *Miner) ListSectors() ([]pipeline.SectorInfo, error) {
return m.sealing.ListSectors()
}

func (m *Miner) PledgeSector(ctx context.Context) (storage.SectorRef, error) {
return m.sealing.PledgeSector(ctx)
}

func (m *Miner) ForceSectorState(ctx context.Context, id abi.SectorNumber, state sealing2.SectorState) error {
func (m *Miner) ForceSectorState(ctx context.Context, id abi.SectorNumber, state pipeline.SectorState) error {
return m.sealing.ForceSectorState(ctx, id, state)
}

Expand Down
46 changes: 23 additions & 23 deletions storage/paths/http_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/filecoin-project/specs-storage/storage"

"github.com/filecoin-project/lotus/storage/paths"
mocks2 "github.com/filecoin-project/lotus/storage/paths/mocks"
mocks "github.com/filecoin-project/lotus/storage/paths/mocks"
"github.com/filecoin-project/lotus/storage/sealer/partialfile"
storiface "github.com/filecoin-project/lotus/storage/sealer/storiface"
)
Expand Down Expand Up @@ -64,8 +64,8 @@ func TestRemoteGetAllocated(t *testing.T) {

tcs := map[string]struct {
piFnc func(pi *pieceInfo)
storeFnc func(s *mocks2.MockStore)
pfFunc func(s *mocks2.MockPartialFileHandler)
storeFnc func(s *mocks.MockStore)
pfFunc func(s *mocks.MockPartialFileHandler)

// expectation
expectedStatusCode int
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestRemoteGetAllocated(t *testing.T) {
},
"fails when errors out during acquiring unsealed sector file": {
expectedStatusCode: http.StatusInternalServerError,
storeFnc: func(l *mocks2.MockStore) {
storeFnc: func(l *mocks.MockStore) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -113,7 +113,7 @@ func TestRemoteGetAllocated(t *testing.T) {
},
"fails when unsealed sector file is not found locally": {
expectedStatusCode: http.StatusInternalServerError,
storeFnc: func(l *mocks2.MockStore) {
storeFnc: func(l *mocks.MockStore) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{},
Expand All @@ -122,7 +122,7 @@ func TestRemoteGetAllocated(t *testing.T) {
},
"fails when error while opening partial file": {
expectedStatusCode: http.StatusInternalServerError,
storeFnc: func(l *mocks2.MockStore) {
storeFnc: func(l *mocks.MockStore) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -131,15 +131,15 @@ func TestRemoteGetAllocated(t *testing.T) {
storiface.SectorPaths{}, nil).Times(1)
},

pfFunc: func(pf *mocks2.MockPartialFileHandler) {
pfFunc: func(pf *mocks.MockPartialFileHandler) {
pf.EXPECT().OpenPartialFile(abi.PaddedPieceSize(sectorSize), pfPath).Return(&partialfile.PartialFile{},
xerrors.New("some error")).Times(1)
},
},

"fails when determining partial file allocation returns an error": {
expectedStatusCode: http.StatusInternalServerError,
storeFnc: func(l *mocks2.MockStore) {
storeFnc: func(l *mocks.MockStore) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -148,7 +148,7 @@ func TestRemoteGetAllocated(t *testing.T) {
storiface.SectorPaths{}, nil).Times(1)
},

pfFunc: func(pf *mocks2.MockPartialFileHandler) {
pfFunc: func(pf *mocks.MockPartialFileHandler) {
pf.EXPECT().OpenPartialFile(abi.PaddedPieceSize(sectorSize), pfPath).Return(emptyPartialFile,
nil).Times(1)

Expand All @@ -158,7 +158,7 @@ func TestRemoteGetAllocated(t *testing.T) {
},
"StatusRequestedRangeNotSatisfiable when piece is NOT allocated in partial file": {
expectedStatusCode: http.StatusRequestedRangeNotSatisfiable,
storeFnc: func(l *mocks2.MockStore) {
storeFnc: func(l *mocks.MockStore) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -167,7 +167,7 @@ func TestRemoteGetAllocated(t *testing.T) {
storiface.SectorPaths{}, nil).Times(1)
},

pfFunc: func(pf *mocks2.MockPartialFileHandler) {
pfFunc: func(pf *mocks.MockPartialFileHandler) {
pf.EXPECT().OpenPartialFile(abi.PaddedPieceSize(sectorSize), pfPath).Return(emptyPartialFile,
nil).Times(1)

Expand All @@ -177,7 +177,7 @@ func TestRemoteGetAllocated(t *testing.T) {
},
"OK when piece is allocated in partial file": {
expectedStatusCode: http.StatusOK,
storeFnc: func(l *mocks2.MockStore) {
storeFnc: func(l *mocks.MockStore) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -186,7 +186,7 @@ func TestRemoteGetAllocated(t *testing.T) {
storiface.SectorPaths{}, nil).Times(1)
},

pfFunc: func(pf *mocks2.MockPartialFileHandler) {
pfFunc: func(pf *mocks.MockPartialFileHandler) {
pf.EXPECT().OpenPartialFile(abi.PaddedPieceSize(sectorSize), pfPath).Return(emptyPartialFile,
nil).Times(1)

Expand All @@ -204,8 +204,8 @@ func TestRemoteGetAllocated(t *testing.T) {
// when test is done, assert expectations on all mock objects.
defer mockCtrl.Finish()

lstore := mocks2.NewMockStore(mockCtrl)
pfhandler := mocks2.NewMockPartialFileHandler(mockCtrl)
lstore := mocks.NewMockStore(mockCtrl)
pfhandler := mocks.NewMockPartialFileHandler(mockCtrl)

handler := &paths.FetchHandler{
lstore,
Expand Down Expand Up @@ -274,7 +274,7 @@ func TestRemoteGetSector(t *testing.T) {

tcs := map[string]struct {
siFnc func(pi *sectorInfo)
storeFnc func(s *mocks2.MockStore, path string)
storeFnc func(s *mocks.MockStore, path string)

// reading a file or a dir
isDir bool
Expand All @@ -300,7 +300,7 @@ func TestRemoteGetSector(t *testing.T) {
noResponseBytes: true,
},
"fails when error while acquiring sector file": {
storeFnc: func(l *mocks2.MockStore, _ string) {
storeFnc: func(l *mocks.MockStore, _ string) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -313,7 +313,7 @@ func TestRemoteGetSector(t *testing.T) {
},
"fails when acquired sector file path is empty": {
expectedStatusCode: http.StatusInternalServerError,
storeFnc: func(l *mocks2.MockStore, _ string) {
storeFnc: func(l *mocks.MockStore, _ string) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{},
Expand All @@ -323,7 +323,7 @@ func TestRemoteGetSector(t *testing.T) {
},
"fails when acquired file does not exist": {
expectedStatusCode: http.StatusInternalServerError,
storeFnc: func(l *mocks2.MockStore, _ string) {
storeFnc: func(l *mocks.MockStore, _ string) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -334,7 +334,7 @@ func TestRemoteGetSector(t *testing.T) {
noResponseBytes: true,
},
"successfully read a sector file": {
storeFnc: func(l *mocks2.MockStore, path string) {
storeFnc: func(l *mocks.MockStore, path string) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -349,7 +349,7 @@ func TestRemoteGetSector(t *testing.T) {
expectedResponseBytes: fileBytes,
},
"successfully read a sector dir": {
storeFnc: func(l *mocks2.MockStore, path string) {
storeFnc: func(l *mocks.MockStore, path string) {

l.EXPECT().AcquireSector(gomock.Any(), expectedSectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Expand All @@ -372,8 +372,8 @@ func TestRemoteGetSector(t *testing.T) {
mockCtrl := gomock.NewController(t)
// when test is done, assert expectations on all mock objects.
defer mockCtrl.Finish()
lstore := mocks2.NewMockStore(mockCtrl)
pfhandler := mocks2.NewMockPartialFileHandler(mockCtrl)
lstore := mocks.NewMockStore(mockCtrl)
pfhandler := mocks.NewMockPartialFileHandler(mockCtrl)

var path string

Expand Down
2 changes: 1 addition & 1 deletion storage/paths/mocks/index.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion storage/paths/mocks/pf.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion storage/paths/mocks/store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a581d73

Please sign in to comment.