diff --git a/gql/resolver.go b/gql/resolver.go index f581051ce..026126136 100644 --- a/gql/resolver.go +++ b/gql/resolver.go @@ -5,18 +5,18 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/filecoin-project/boost/node/modules/dtypes" "math" "github.com/dustin/go-humanize" "github.com/filecoin-project/boost-gfm/piecestore" "github.com/filecoin-project/boost-gfm/retrievalmarket" - lotus_storagemarket "github.com/filecoin-project/boost-gfm/storagemarket" + gfm_storagemarket "github.com/filecoin-project/boost-gfm/storagemarket" "github.com/filecoin-project/boost/db" "github.com/filecoin-project/boost/fundmanager" gqltypes "github.com/filecoin-project/boost/gql/types" "github.com/filecoin-project/boost/markets/storageadapter" "github.com/filecoin-project/boost/node/config" + "github.com/filecoin-project/boost/node/modules/dtypes" "github.com/filecoin-project/boost/retrievalmarket/rtvllog" "github.com/filecoin-project/boost/storagemanager" "github.com/filecoin-project/boost/storagemarket" @@ -54,7 +54,7 @@ type resolver struct { fundMgr *fundmanager.FundManager storageMgr *storagemanager.StorageManager provider *storagemarket.Provider - legacyProv lotus_storagemarket.StorageProvider + legacyProv gfm_storagemarket.StorageProvider legacyDT dtypes.ProviderDataTransfer ps piecestore.PieceStore sa retrievalmarket.SectorAccessor @@ -64,7 +64,7 @@ type resolver struct { fullNode v1api.FullNode } -func NewResolver(cfg *config.Boost, r lotus_repo.LockedRepo, h host.Host, dealsDB *db.DealsDB, logsDB *db.LogsDB, retDB *rtvllog.RetrievalLogDB, plDB *db.ProposalLogsDB, fundsDB *db.FundsDB, fundMgr *fundmanager.FundManager, storageMgr *storagemanager.StorageManager, spApi sealingpipeline.API, provider *storagemarket.Provider, legacyProv lotus_storagemarket.StorageProvider, legacyDT dtypes.ProviderDataTransfer, ps piecestore.PieceStore, sa retrievalmarket.SectorAccessor, dagst dagstore.Interface, publisher *storageadapter.DealPublisher, fullNode v1api.FullNode) *resolver { +func NewResolver(cfg *config.Boost, r lotus_repo.LockedRepo, h host.Host, dealsDB *db.DealsDB, logsDB *db.LogsDB, retDB *rtvllog.RetrievalLogDB, plDB *db.ProposalLogsDB, fundsDB *db.FundsDB, fundMgr *fundmanager.FundManager, storageMgr *storagemanager.StorageManager, spApi sealingpipeline.API, provider *storagemarket.Provider, legacyProv gfm_storagemarket.StorageProvider, legacyDT dtypes.ProviderDataTransfer, ps piecestore.PieceStore, sa retrievalmarket.SectorAccessor, dagst dagstore.Interface, publisher *storageadapter.DealPublisher, fullNode v1api.FullNode) *resolver { return &resolver{ cfg: cfg, repo: r, diff --git a/indexprovider/wrapper.go b/indexprovider/wrapper.go index 902b766ae..95faf61c7 100644 --- a/indexprovider/wrapper.go +++ b/indexprovider/wrapper.go @@ -18,7 +18,7 @@ import ( dst "github.com/filecoin-project/dagstore" "github.com/filecoin-project/lotus/markets/dagstore" - lotus_storagemarket "github.com/filecoin-project/boost-gfm/storagemarket" + gfm_storagemarket "github.com/filecoin-project/boost-gfm/storagemarket" "github.com/filecoin-project/boost/db" "github.com/filecoin-project/boost/node/config" "github.com/filecoin-project/boost/storagemarket/types/dealcheckpoints" @@ -41,7 +41,7 @@ type Wrapper struct { cfg *config.Boost enabled bool dealsDB *db.DealsDB - legacyProv lotus_storagemarket.StorageProvider + legacyProv gfm_storagemarket.StorageProvider prov provider.Interface dagStore *dagstore.Wrapper meshCreator idxprov.MeshCreator @@ -52,11 +52,11 @@ type Wrapper struct { } func NewWrapper(cfg *config.Boost) func(lc fx.Lifecycle, h host.Host, r repo.LockedRepo, dealsDB *db.DealsDB, - legacyProv lotus_storagemarket.StorageProvider, prov provider.Interface, dagStore *dagstore.Wrapper, + legacyProv gfm_storagemarket.StorageProvider, prov provider.Interface, dagStore *dagstore.Wrapper, meshCreator idxprov.MeshCreator) (*Wrapper, error) { return func(lc fx.Lifecycle, h host.Host, r repo.LockedRepo, dealsDB *db.DealsDB, - legacyProv lotus_storagemarket.StorageProvider, prov provider.Interface, dagStore *dagstore.Wrapper, + legacyProv gfm_storagemarket.StorageProvider, prov provider.Interface, dagStore *dagstore.Wrapper, meshCreator idxprov.MeshCreator) (*Wrapper, error) { if cfg.DAGStore.RootDir == "" { cfg.DAGStore.RootDir = filepath.Join(r.Path(), defaultDagStoreDir) diff --git a/markets/dealfilter/cli.go b/markets/dealfilter/cli.go deleted file mode 100644 index 7e411a0c2..000000000 --- a/markets/dealfilter/cli.go +++ /dev/null @@ -1,64 +0,0 @@ -package dealfilter - -// TODO: remove file? - -//import ( -// "bytes" -// "context" -// "encoding/json" -// "os/exec" -// -// "github.com/filecoin-project/boost-gfm/retrievalmarket" -// "github.com/filecoin-project/boost-gfm/storagemarket" -// -// "github.com/filecoin-project/boost/node/modules/dtypes" -//) -// -//func CliStorageDealFilter(cmd string) dtypes.StorageDealFilter { -// return func(ctx context.Context, deal storagemarket.MinerDeal) (bool, string, error) { -// d := struct { -// storagemarket.MinerDeal -// DealType string -// }{ -// MinerDeal: deal, -// DealType: "storage", -// } -// return runDealFilter(ctx, cmd, d) -// } -//} -// -//func CliRetrievalDealFilter(cmd string) dtypes.RetrievalDealFilter { -// return func(ctx context.Context, deal retrievalmarket.ProviderDealState) (bool, string, error) { -// d := struct { -// retrievalmarket.ProviderDealState -// DealType string -// }{ -// ProviderDealState: deal, -// DealType: "retrieval", -// } -// return runDealFilter(ctx, cmd, d) -// } -//} -// -//func runDealFilter(ctx context.Context, cmd string, deal interface{}) (bool, string, error) { -// j, err := json.MarshalIndent(deal, "", " ") -// if err != nil { -// return false, "", err -// } -// -// var out bytes.Buffer -// -// c := exec.Command("sh", "-c", cmd) -// c.Stdin = bytes.NewReader(j) -// c.Stdout = &out -// c.Stderr = &out -// -// switch err := c.Run().(type) { -// case nil: -// return true, "", nil -// case *exec.ExitError: -// return false, out.String(), nil -// default: -// return false, "filter cmd run error", err -// } -//} diff --git a/node/builder.go b/node/builder.go index 764ef4e54..58ada4404 100644 --- a/node/builder.go +++ b/node/builder.go @@ -5,13 +5,12 @@ import ( "database/sql" "errors" "fmt" - storageimpl "github.com/filecoin-project/boost-gfm/storagemarket/impl" - lotus_gfm_storagemarket "github.com/filecoin-project/go-fil-markets/storagemarket" "time" "github.com/filecoin-project/boost-gfm/retrievalmarket" rmnet "github.com/filecoin-project/boost-gfm/retrievalmarket/network" gfm_storagemarket "github.com/filecoin-project/boost-gfm/storagemarket" + storageimpl "github.com/filecoin-project/boost-gfm/storagemarket/impl" "github.com/filecoin-project/boost-gfm/storagemarket/impl/storedask" "github.com/filecoin-project/boost-gfm/stores" "github.com/filecoin-project/boost/api" @@ -42,6 +41,7 @@ import ( "github.com/filecoin-project/boostd-data/shared/tracing" "github.com/filecoin-project/dagstore" "github.com/filecoin-project/go-address" + lotus_gfm_storagemarket "github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-state-types/abi" lotus_api "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" @@ -593,7 +593,7 @@ func ConfigBoost(cfg *config.Boost) Option { ), // Lotus markets retrieval deal filter - Override(new(lotus_gfm_storagemarket.StorageProviderNode), modules.LotusFGMStorageProviderNode), + Override(new(lotus_gfm_storagemarket.StorageProviderNode), modules.LotusGFMStorageProviderNode), Override(new(lotus_dtypes.RetrievalDealFilter), lotus_modules.RetrievalDealFilter(nil)), If(cfg.LotusDealmaking.RetrievalFilter != "", Override(new(lotus_dtypes.RetrievalDealFilter), lotus_modules.RetrievalDealFilter(lotus_dealfilter.CliRetrievalDealFilter(cfg.LotusDealmaking.RetrievalFilter))), diff --git a/node/impl/boost.go b/node/impl/boost.go index 81d0b0ea2..7353b9327 100644 --- a/node/impl/boost.go +++ b/node/impl/boost.go @@ -13,7 +13,7 @@ import ( "go.opentelemetry.io/otel/attribute" "github.com/filecoin-project/boost-gfm/retrievalmarket" - lotus_storagemarket "github.com/filecoin-project/boost-gfm/storagemarket" + gfm_storagemarket "github.com/filecoin-project/boost-gfm/storagemarket" "github.com/filecoin-project/boost/api" "github.com/filecoin-project/boost/gql" "github.com/filecoin-project/boost/indexprovider" @@ -60,7 +60,7 @@ type BoostAPI struct { IndexProvider *indexprovider.Wrapper // Legacy Lotus - LegacyStorageProvider lotus_storagemarket.StorageProvider + LegacyStorageProvider gfm_storagemarket.StorageProvider // Lotus Markets SectorBlocks *sectorblocks.SectorBlocks diff --git a/node/impl/boost_legacy.go b/node/impl/boost_legacy.go index 8c27f7d18..03d726107 100644 --- a/node/impl/boost_legacy.go +++ b/node/impl/boost_legacy.go @@ -3,7 +3,6 @@ package impl import ( "context" "fmt" - "github.com/filecoin-project/boost/api" "os" "strconv" "time" @@ -14,6 +13,7 @@ import ( "github.com/filecoin-project/boost-gfm/piecestore" "github.com/filecoin-project/boost-gfm/retrievalmarket" "github.com/filecoin-project/boost-gfm/storagemarket" + "github.com/filecoin-project/boost/api" "github.com/filecoin-project/go-address" datatransfer "github.com/filecoin-project/go-data-transfer" "github.com/filecoin-project/go-state-types/abi" diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 3e1750250..064b41e0f 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -817,7 +817,7 @@ func RetrievalProvider( ) } -func LotusFGMStorageProviderNode(spn gfm_storagemarket.StorageProviderNode) lotus_gfm_storagemarket.StorageProviderNode { +func LotusGFMStorageProviderNode(spn gfm_storagemarket.StorageProviderNode) lotus_gfm_storagemarket.StorageProviderNode { return &lotusGFMSPN{StorageProviderNode: spn} } diff --git a/node/modules/storageminer_dagstore.go b/node/modules/storageminer_dagstore.go index a06907418..27575467d 100644 --- a/node/modules/storageminer_dagstore.go +++ b/node/modules/storageminer_dagstore.go @@ -136,93 +136,3 @@ func (l *lotusProviderPieceStore) GetCIDInfo(payloadCID cid.Cid) (lotus_gfm_piec PieceBlockLocations: bls, }, nil } - -//import ( -// "context" -// "fmt" -// "github.com/filecoin-project/boost/node/modules/dtypes" -// "github.com/filecoin-project/dagstore" -// mdagstore "github.com/filecoin-project/lotus/markets/dagstore" -// "github.com/filecoin-project/lotus/node/config" -// "github.com/filecoin-project/lotus/node/repo" -// "github.com/libp2p/go-libp2p/core/host" -// "go.uber.org/fx" -// "golang.org/x/xerrors" -// "os" -// "path/filepath" -// "strconv" -//) -// -//const ( -// EnvDAGStoreCopyConcurrency = "LOTUS_DAGSTORE_COPY_CONCURRENCY" -// DefaultDAGStoreDir = "dagstore" -//) -// -//// NewMinerAPI creates a new MinerAPI adaptor for the dagstore mounts. -//func NewMinerAPI(cfg config.DAGStoreConfig) func(fx.Lifecycle, repo.LockedRepo, dtypes.ProviderPieceStore, mdagstore.SectorAccessor) (mdagstore.MinerAPI, error) { -// return func(lc fx.Lifecycle, r repo.LockedRepo, pieceStore dtypes.ProviderPieceStore, sa mdagstore.SectorAccessor) (mdagstore.MinerAPI, error) { -// // caps the amount of concurrent calls to the storage, so that we don't -// // spam it during heavy processes like bulk migration. -// if v, ok := os.LookupEnv("LOTUS_DAGSTORE_MOUNT_CONCURRENCY"); ok { -// concurrency, err := strconv.Atoi(v) -// if err == nil { -// cfg.MaxConcurrencyStorageCalls = concurrency -// } -// } -// -// mountApi := mdagstore.NewMinerAPI(pieceStore, sa, cfg.MaxConcurrencyStorageCalls, cfg.MaxConcurrentUnseals) -// ready := make(chan error, 1) -// pieceStore.OnReady(func(err error) { -// ready <- err -// }) -// lc.Append(fx.Hook{ -// OnStart: func(ctx context.Context) error { -// if err := <-ready; err != nil { -// return fmt.Errorf("aborting dagstore start; piecestore failed to start: %s", err) -// } -// return mountApi.Start(ctx) -// }, -// OnStop: func(context.Context) error { -// return nil -// }, -// }) -// -// return mountApi, nil -// } -//} -// -//// DAGStore constructs a DAG store using the supplied minerAPI, and the -//// user configuration. It returns both the DAGStore and the Wrapper suitable for -//// passing to markets. -//func DAGStore(cfg config.DAGStoreConfig) func(lc fx.Lifecycle, r repo.LockedRepo, minerAPI mdagstore.MinerAPI, h host.Host) (*dagstore.DAGStore, *mdagstore.Wrapper, error) { -// return func(lc fx.Lifecycle, r repo.LockedRepo, minerAPI mdagstore.MinerAPI, h host.Host) (*dagstore.DAGStore, *mdagstore.Wrapper, error) { -// // fall back to default root directory if not explicitly set in the config. -// if cfg.RootDir == "" { -// cfg.RootDir = filepath.Join(r.Path(), DefaultDAGStoreDir) -// } -// -// v, ok := os.LookupEnv(EnvDAGStoreCopyConcurrency) -// if ok { -// concurrency, err := strconv.Atoi(v) -// if err == nil { -// cfg.MaxConcurrentReadyFetches = concurrency -// } -// } -// -// dagst, w, err := mdagstore.NewDAGStore(cfg, minerAPI, h) -// if err != nil { -// return nil, nil, xerrors.Errorf("failed to create DAG store: %w", err) -// } -// -// lc.Append(fx.Hook{ -// OnStart: func(ctx context.Context) error { -// return w.Start(ctx) -// }, -// OnStop: func(context.Context) error { -// return w.Close() -// }, -// }) -// -// return dagst, w, nil -// } -//} diff --git a/storagemarket/provider.go b/storagemarket/provider.go index 2f23a0670..e6aa5bd3f 100644 --- a/storagemarket/provider.go +++ b/storagemarket/provider.go @@ -5,7 +5,6 @@ import ( "database/sql" "errors" "fmt" - "github.com/filecoin-project/dagstore" "io" "os" "sync" @@ -29,6 +28,7 @@ import ( "github.com/filecoin-project/boost/storagemarket/types/dealcheckpoints" "github.com/filecoin-project/boost/transport" "github.com/filecoin-project/boostd-data/shared/tracing" + "github.com/filecoin-project/dagstore" "github.com/filecoin-project/go-address" lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v1api"